This commit is contained in:
emmett1
2017-08-06 17:57:39 +08:00
parent 61f601698a
commit e685a74e14
2 changed files with 28 additions and 18 deletions

View File

@@ -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

View File

@@ -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