Skip to content

Commit

Permalink
Merge pull request #69 from bb441db/linux
Browse files Browse the repository at this point in the history
Post install & remove for debian package
  • Loading branch information
shiftkey authored Oct 11, 2018
2 parents df929b0 + 30f1714 commit 3edcd60
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions script/electron-builder-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ linux:
- AppImage
maintainer: 'GitHub, Inc <[email protected]>'
deb:
afterInstall: './script/linux-after-install.sh'
afterRemove: './script/linux-after-remove.sh'
depends:
# default Electron dependencies
- gconf2
Expand Down
25 changes: 25 additions & 0 deletions script/linux-after-install.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions script/linux-after-remove.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3edcd60

Please sign in to comment.