diff --git a/resources/linux/debian/postinst.template b/resources/linux/debian/postinst.template index c440312f331..9c49ab29457 100755 --- a/resources/linux/debian/postinst.template +++ b/resources/linux/debian/postinst.template @@ -36,9 +36,27 @@ if [ "@@NAME@@" != "code-oss" ]; then eval $(apt-config shell APT_TRUSTED_PARTS Dir::Etc::trustedparts/d) CODE_TRUSTED_PART=${APT_TRUSTED_PARTS}microsoft.gpg - # Sourced from https://packages.microsoft.com/keys/microsoft.asc - if [ ! -f $CODE_TRUSTED_PART ]; then - echo "-----BEGIN PGP PUBLIC KEY BLOCK----- + # Install repository source list + WRITE_SOURCE=0 + if [ ! -f $CODE_SOURCE_PART ] && [ ! -f /etc/rpi-issue ]; then + # Write source list if it does not exist and we're not running on Raspberry Pi OS + WRITE_SOURCE=1 + elif grep -Eq "http:\/\/packages\.microsoft\.com\/repos\/vscode" $CODE_SOURCE_PART; then + # Migrate from old repository + WRITE_SOURCE=1 + elif grep -q "# disabled on upgrade to" $CODE_SOURCE_PART; then + # Write source list if it was disabled by OS upgrade + WRITE_SOURCE=1 + fi + + if [ "$WRITE_SOURCE" -eq "1" ]; then + echo "### THIS FILE IS AUTOMATICALLY CONFIGURED ### +# You may comment out this entry, but any other modifications may be lost. +deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main" > $CODE_SOURCE_PART + + # Sourced from https://packages.microsoft.com/keys/microsoft.asc + if [ ! -f $CODE_TRUSTED_PART ]; then + echo "-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.7 (GNU/Linux) mQENBFYxWIwBCADAKoZhZlJxGNGWzqV+1OG1xiQeoowKhssGAKvd+buXCGISZJwT @@ -57,25 +75,7 @@ XdNgj4Jd2/g6T9InmWT0hASljur+dJnzNiNCkbn9KbX7J/qK1IbR8y560yRmFsU+ NdCFTW7wY0Fb1fWJ+/KTsC4= =J6gs -----END PGP PUBLIC KEY BLOCK----- -" | gpg --dearmor > microsoft.gpg - mv microsoft.gpg $CODE_TRUSTED_PART - fi - - # Install repository source list - WRITE_SOURCE=0 - if [ ! -f $CODE_SOURCE_PART ]; then - # Write source list if it does not exist - WRITE_SOURCE=1 - elif grep -Eq "http:\/\/packages\.microsoft\.com\/repos\/vscode" $CODE_SOURCE_PART; then - # Migrate from old repository - WRITE_SOURCE=1 - elif grep -q "# disabled on upgrade to" $CODE_SOURCE_PART; then - # Write source list if it was disabled by OS upgrade - WRITE_SOURCE=1 - fi - if [ "$WRITE_SOURCE" -eq "1" ]; then - echo "### THIS FILE IS AUTOMATICALLY CONFIGURED ### -# You may comment out this entry, but any other modifications may be lost. -deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main" > $CODE_SOURCE_PART +" | gpg --dearmor > $CODE_TRUSTED_PART + fi fi fi