diff --git a/script/electron-builder-linux.yml b/script/electron-builder-linux.yml index e0ea9a414ca..b096a6da00f 100644 --- a/script/electron-builder-linux.yml +++ b/script/electron-builder-linux.yml @@ -11,6 +11,8 @@ linux: - AppImage maintainer: 'GitHub, Inc ' deb: + afterInstall: './script/linux-after-install.sh' + afterRemove: './script/linux-after-remove.sh' depends: # default Electron dependencies - gconf2 diff --git a/script/linux-after-install.sh b/script/linux-after-install.sh new file mode 100644 index 00000000000..bd40c2b3785 --- /dev/null +++ b/script/linux-after-install.sh @@ -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 diff --git a/script/linux-after-remove.sh b/script/linux-after-remove.sh new file mode 100644 index 00000000000..7260fd93767 --- /dev/null +++ b/script/linux-after-remove.sh @@ -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 \ No newline at end of file