Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix post-remove script example #549

Merged
merged 1 commit into from Sep 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 19 additions & 18 deletions www/docs/tips.md
Expand Up @@ -102,39 +102,40 @@ cleanup
```bash
#!/bin/sh

cleanInstall() {
printf "\033[32m Post Install of a clean install\033[0m\n"
remove() {
printf "\033[32m Post Remove of a normal remove\033[0m\n"
echo "Remove" > /tmp/postremove-proof
}

purge() {
printf "\033[32m Post Remove purge, deb only\033[0m\n"
echo "Purge" > /tmp/postremove-proof
}

upgrade() {
printf "\033[32m Post Install of an upgrade\033[0m\n"
printf "\033[32m Post Remove of an upgrade\033[0m\n"
echo "Upgrade" > /tmp/postremove-proof
}

echo "$@"

action="$1"
if [ "$1" = "configure" ] && [ -z "$2" ]; then
# Alpine linux does not pass args, and deb passes $1=configure
action="install"
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
# deb passes $1=configure $2=<current version>
action="upgrade"
fi

case "$action" in
"1" | "install")
printf "\033[32m Post Install of a clean install\033[0m\n"
cleanInstall
"0" | "remove")
remove
;;
"2" | "upgrade")
printf "\033[32m Post Install of an upgrade\033[0m\n"
"1" | "upgrade")
upgrade
;;
"purge")
purge
;;
*)
# $1 == version being installed
printf "\033[32m Alpine\033[0m"
cleanInstall
remove
;;
esac

```

### Deb & RPM
Expand Down