modify self update mitigation
This commit is contained in:
parent
fe46b00ba6
commit
0c8c9bef98
2 changed files with 3 additions and 4 deletions
|
|
@ -139,4 +139,4 @@ deploy)
|
||||||
*) usage && exit 1 ;;
|
*) usage && exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$_self_update" ] && gen_self_update && _ZPKG_SELF_UPGRADE=y exec "$_tmpzpkg" -R install zpkg
|
[ -n "$_self_update" ] && do_self_update
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,10 @@ upgrade_package()
|
||||||
## self upgrading mitigation
|
## self upgrading mitigation
|
||||||
|
|
||||||
unset _self_update
|
unset _self_update
|
||||||
gen_self_update()
|
do_self_update()
|
||||||
{
|
{
|
||||||
_tmpzpkg="$TMPDIR/zpkg_bin_$(random_string 5)"
|
_tmpzpkg="$TMPDIR/zpkg_bin_$(random_string 5)"
|
||||||
# copy current file
|
# copy current file
|
||||||
cp "$0" "$_tmpzpkg" || return $?
|
cp "$0" "$_tmpzpkg" || return $?
|
||||||
# make new script self-delete
|
exec sh -c '_ZPKG_SELF_UPGRADE=y "$1" -R install zpkg ; rm -f "$1"' sh "$_tmpzpkg"
|
||||||
echo 'rm -f "$0"' >> "$_tmpzpkg"
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue