diff --git a/README.md b/README.md index 5a73e23d..3fb03b33 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ As an alternative to `.deb` and `.rpm` packages on the website, you can also ins #### Debian ```shell -wget -q http://headsetapp.co/headset-electron/headset.asc -O- | sudo apt-key add - -echo "deb [arch=amd64] http://headsetapp.co/headset-electron/debian stable non-free" | sudo tee /etc/apt/sources.list.d/headset.list +wget -q http://headsetapp.co/headset-electron/headset.gpg -O- | sudo tee /usr/share/keyrings/headset-archive-keyring.gpg +echo "deb [arch=amd64 signed-by=/usr/share/keyrings/headset-archive-keyring.gpg] http://headsetapp.co/headset-electron/debian stable non-free" | sudo tee /etc/apt/sources.list.d/headset.list sudo apt-get update sudo apt-get install headset ``` diff --git a/bin/debian_scripts/postinst b/bin/debian_scripts/postinst index 69a3cd20..8a298170 100755 --- a/bin/debian_scripts/postinst +++ b/bin/debian_scripts/postinst @@ -2,52 +2,35 @@ set -e -REPOCONFIG="deb [arch=amd64] http://headsetapp.co/headset-electron/debian stable non-free" -APT_SOURCESDIR="/etc/apt/sources.list.d/" -SOURCELIST="$APT_SOURCESDIR/headset.list" +KEY_ID="6E15 1B86 388F 9659 70CA 2B90 53E3 2C39 9D78 2F91" +KEYRING_DIR="/usr/share/keyrings" +KEYRING="${KEYRING_DIR}/headset-archive-keyring.gpg" +APT_SOURCES_DIR="/etc/apt/sources.list.d/" +SOURCE_LIST="${APT_SOURCES_DIR}/headset.list" +REPO_CONFIG="deb [arch=amd64 signed-by=${KEYRING}] https://headsetapp.co/headset-electron/debian stable non-free" -install_key() { - APT_KEY="$(which apt-key 2> /dev/null)" - if [ -x "$APT_KEY" ]; then - "$APT_KEY" add - >/dev/null 2>&1 < /dev/null | grep -q "${KEY_ID}"; then + ${APT_KEY} del "${KEY_ID}" + fi + fi +} -mQINBFnMhmcBEAC89TE4M7muWVfEjd6pU21+QQ54ve9g49sC8dcar/nT8FjkU4UU -g3TtDo4ISzYmc1ff/oic8EEwXiBkuRCB0idho8+g6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y0LtQ5fqijKiOGyV+VE4zWO4DhnCa7/psNEqbDDu23eskhNYIbwUFb7X -+kW8uhhiPXtUL6BlfUXtjlFhKn5SnA6HKl0s51ZrUGrxkTKff6A/BX5FA7eKnQ97 -ugjDVIjmGqll5lYYFLLno5fwks0ZtW9cKuTE+hlalYekszo0gh/6Ey8gsVg7QZOm -SCadlEm+yapn18PSuYDne3L4PllbAizHLQujY9OLoEfKX4qkMXxGWDFV15wqP7JH -7N3FyqFuclC3CPsRxjkbNlzEHPpJW1AvdrooChdSJxIsf0lJL9KrN684y/3Rczyd -d6INGg3lPhwkS+qot6dvuMup1zePb4h2GnMiEOykL5N9zQ4jiErnXD4SlYLzMdyq -0FDwaKLftbXQwBo= -=zPNg ------END PGP PUBLIC KEY BLOCK----- -KEYDATA +# Move the key +install_key() { + if [ -d "${KEYRING_DIR}" ]; then + mv /usr/lib/headset/headset-archive-keyring.gpg "${KEYRING}" + return 0 fi + return 1 } # Creates the repository source file create_sources_lists() { - if [ -d "$APT_SOURCESDIR" ]; then - if echo "$REPOCONFIG" > "$SOURCELIST"; then + if [ -d "${APT_SOURCES_DIR}" ]; then + if echo "${REPO_CONFIG}" > "${SOURCE_LIST}"; then return 0 fi fi @@ -57,3 +40,4 @@ create_sources_lists() { ## MAIN ## install_key create_sources_lists +uninstall_key diff --git a/bin/debian_scripts/postrm b/bin/debian_scripts/postrm index 774054c7..f469846f 100755 --- a/bin/debian_scripts/postrm +++ b/bin/debian_scripts/postrm @@ -2,25 +2,22 @@ set -e -KEYID="9D782F91" - action=$1 # Only do complete clean-up on purge. -if [ "$action" != "purge" ] ; then +if [ "${action}" != "purge" ] ; then exit 0 fi -APT_SOURCESDIR="/etc/apt/sources.list.d/" -SOURCELIST="$APT_SOURCESDIR/headset.list" +APT_SOURCES_DIR="/etc/apt/sources.list.d/" +SOURCE_LIST="${APT_SOURCES_DIR}/headset.list" +KEYRING_DIR="/usr/share/keyrings" +KEYRING="${KEYRING_DIR}/co.headsetapp.headset-keyring.gpg" # Clean sources lists -rm -f "$SOURCELIST"* +rm -f "${SOURCE_LIST}"* # Remove key -APT_KEY="$(which apt-key 2> /dev/null)" -if [ -x "$APT_KEY" ]; then - "$APT_KEY" remove "$KEYID" >/dev/null 2>&1 +if [ -f "${KEYRING}" ]; then + rm -f "${KEYRING}" fi - -# TODO: Remove config? diff --git a/bin/packager/linux.sh b/bin/packager/linux.sh index ed18782d..933707c4 100755 --- a/bin/packager/linux.sh +++ b/bin/packager/linux.sh @@ -6,10 +6,13 @@ source="build/Headset-linux-x64" OS=linux node bin/packager/packager.js +# Add repository signing key +cp gh-pages/headset.gpg "${source}/headset-archive-keyring.gpg" + echo -e '\n\033[1mFixing various file permissions: \033[01;0m' -find $source -type f -exec chmod 0644 {} + -find $source -type d -exec chmod 0755 {} + -chmod 0755 $source/headset +find "${source}" -type f -exec chmod 0644 {} + +find "${source}" -type d -exec chmod 0755 {} + +chmod 0755 "${source}/headset" chmod 0755 bin/debian_scripts/postinst chmod 0755 bin/debian_scripts/postrm echo -e 'Done' diff --git a/gh-pages/headset.gpg b/gh-pages/headset.gpg new file mode 100644 index 00000000..db210a4d Binary files /dev/null and b/gh-pages/headset.gpg differ