add install hooks to deb package

Co-Authored-By: bb441db <jelle.keeris@gmail.com>
This commit is contained in:
Brendan Forster 2018-10-19 15:38:23 -03:00
parent 8cc232f42d
commit d4713a175b
3 changed files with 46 additions and 0 deletions

View file

@ -11,6 +11,8 @@ linux:
- AppImage
maintainer: 'GitHub, Inc <opensource+desktop@github.com>'
deb:
afterInstall: './script/linux-after-install.sh'
afterRemove: './script/linux-after-remove.sh'
depends:
# default Electron dependencies
- gconf2

View file

@ -0,0 +1,25 @@
#!/bin/bash
set -e
PROFILE_D_FILE="/etc/profile.d/${productFilename}.sh"
INSTALL_DIR="/opt/${productFilename}"
SCRIPT="#!/bin/sh
export PATH=$INSTALL_DIR:\$PATH"
case "$1" in
configure)
echo "$SCRIPT" > ${PROFILE_D_FILE};
. ${PROFILE_D_FILE};
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

View file

@ -0,0 +1,19 @@
#!/bin/bash
set -e
PROFILE_D_FILE="/etc/profile.d/${productFilename}.sh"
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
echo "#!/bin/sh" > ${PROFILE_D_FILE};
. ${PROFILE_D_FILE};
rm ${PROFILE_D_FILE};
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0