diff --git a/installpkg b/installpkg index f4e7c03..d57bbfd 100755 --- a/installpkg +++ b/installpkg @@ -27,12 +27,12 @@ installpkg() { # run preinstall script if no --no-preinstall flag and not upgrade package if [ ! "$NO_PREINSTALL" ] && [ ! "$UPGRADE_PKG" ]; then - run_preinstall + newversion="$version" newrelease="$release" run_preinstall fi # run preupgrade script if package upgrade if [ "$UPGRADE_PKG" ] && [ ! "$NO_PREUPGRADE" ]; then - run_preupgrade + newversion="$version" oldversion="$iversion" newrelease="$release" oldrelease="$irelease" run_preupgrade fi #installing package into system @@ -63,11 +63,11 @@ installpkg() { msg "Successfully install ${color_green}$packagename${color_reset}." if [ ! "$NO_POSTINSTALL" ] && [ ! "$UPGRADE_PKG" ]; then - run_postinstall + newversion="$version" newrelease="$release" run_postinstall fi if [ "$UPGRADE_PKG" ] && [ ! "$NO_POSTUPGRADE" ]; then - run_postupgrade + newversion="$version" oldversion="$iversion" newrelease="$release" oldrelease="$irelease" run_postupgrade fi restoreconf @@ -382,11 +382,11 @@ main() { fi ### GET NAME, VERSION, RELEASE FROM PACKAGE ### - getname + getname # get info from package ### IF INSTALLED & NO UPGRADE & NO REINSTALL ### if [ -d $INDEX_DIR/$name ] && [ ! "$UPGRADE_PKG" ] && [ ! "$REINSTALL_PKG" ]; then - getoldname # GET NAME, VERSION, RELEASE FROM INSTALLED PACKAGE DATABASE + getoldname # get info from package index msg "Package ${color_green}$ipackagename${color_reset} already installed." exit 0 fi diff --git a/removepkg b/removepkg index bf32e1d..3baa308 100755 --- a/removepkg +++ b/removepkg @@ -14,12 +14,8 @@ removepkg() { # create lock file prevent simultaneous install/remove process running spkglock - # preremove script - if [ ! "$NO_PREREMOVE" ]; then - if [ -f $INDEX_DIR/$1/preremove ]; then - msg "Running preremove script." - sh $INDEX_DIR/$1/preremove && PREREMOVE_STATUS=OK || PREREMOVE_STATUS=KO - fi + if [ ! "$NO_PREREMOVE" ]; then + oldversion="$iversion" oldrelease="$irelease" run_preremove $1 fi msg "Removing ${color_green}$ipackagename${color_reset}..." @@ -33,12 +29,8 @@ removepkg() { popd done < <(tac $INDEX_DIR/$1/.files) - # postremove script - if [ ! $NO_POSTREMOVE ]; then - if [ -f $INDEX_DIR/$1/postremove ]; then - msg "Running postremove script." - sh $INDEX_DIR/$1/postremove && POSTREMOVE_STATUS=OK || POSTREMOVE_STATUS=KO - fi + if [ ! "$NO_POSTREMOVE" ]; then + oldversion="$iversion" oldrelease="$irelease" run_postremove $1 fi for file in $(cat $INDEX_DIR/$1/.files); do @@ -72,6 +64,24 @@ removepkg() { spkglock } +run_preremove() { + + if [ -f $INDEX_DIR/$1/preremove ]; then + msg "Running preremove script..." + sh $INDEX_DIR/$1/preremove && PREREMOVE_STATUS=OK || PREREMOVE_STATUS=KO + fi + +} + +run_postremove() { + + if [ -f $INDEX_DIR/$1/postremove ]; then + msg "Running postremove script..." + sh $INDEX_DIR/$1/postremove && POSTREMOVE_STATUS=OK || POSTREMOVE_STATUS=KO + fi + +} + updateinfopages() { pushd /usr/share/info