mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Signed-off-by: Matthias Breithaupt <m.breithaupt@vogl-electronic.com>
This commit is contained in:
@@ -35,20 +35,46 @@ if [ "@@NAME@@" != "code-oss" ]; then
|
||||
eval $(apt-config shell APT_TRUSTED_PARTS Dir::Etc::trustedparts/d)
|
||||
CODE_TRUSTED_PART=${APT_TRUSTED_PARTS}microsoft.gpg
|
||||
|
||||
RET=true
|
||||
if [ -e '/usr/share/debconf/confmodule' ]; then
|
||||
. /usr/share/debconf/confmodule
|
||||
db_get @@NAME@@/add-microsoft-repo || true
|
||||
fi
|
||||
|
||||
# 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
|
||||
if [ "$RET" = false ]; then
|
||||
# The user does not want to add the microsoft repository
|
||||
WRITE_SOURCE=0
|
||||
elif grep -q "http://packages.microsoft.com/repos/vscode" $CODE_SOURCE_PART; then
|
||||
# Migrate from old repository
|
||||
WRITE_SOURCE=2
|
||||
elif grep -q "http://packages.microsoft.com/repos/code" $CODE_SOURCE_PART; then
|
||||
# Migrate from old repository
|
||||
WRITE_SOURCE=2
|
||||
elif apt-cache policy | grep -q "https://packages.microsoft.com/repos/code"; then
|
||||
# Skip following checks if the repo is already known to apt
|
||||
WRITE_SOURCE=0
|
||||
elif [ ! -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 -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
|
||||
if [ "$WRITE_SOURCE" -eq "1" ] && [ -e '/usr/share/debconf/confmodule' ]; then
|
||||
# Ask the user whether to actually write the source list
|
||||
db_input high @@NAME@@/add-microsoft-repo || true
|
||||
db_go || true
|
||||
|
||||
db_get @@NAME@@/add-microsoft-repo
|
||||
if [ "$RET" = false ]; then
|
||||
WRITE_SOURCE=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$WRITE_SOURCE" -ne "0" ]; 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] https://packages.microsoft.com/repos/code stable main" > $CODE_SOURCE_PART
|
||||
|
||||
@@ -14,3 +14,22 @@ fi
|
||||
if hash update-mime-database 2>/dev/null; then
|
||||
update-mime-database /usr/share/mime
|
||||
fi
|
||||
|
||||
RET=true
|
||||
if [ -e '/usr/share/debconf/confmodule' ]; then
|
||||
. /usr/share/debconf/confmodule
|
||||
db_get @@NAME@@/add-microsoft-repo || true
|
||||
fi
|
||||
if [ "$RET" = "true" ]; then
|
||||
eval $(apt-config shell APT_SOURCE_PARTS Dir::Etc::sourceparts/d)
|
||||
CODE_SOURCE_PART=${APT_SOURCE_PARTS}vscode.list
|
||||
rm -f $CODE_SOURCE_PART
|
||||
|
||||
eval $(apt-config shell APT_TRUSTED_PARTS Dir::Etc::trustedparts/d)
|
||||
CODE_TRUSTED_PART=${APT_TRUSTED_PARTS}microsoft.gpg
|
||||
rm -f $CODE_TRUSTED_PART
|
||||
fi
|
||||
|
||||
if [ "$1" = "purge" ] && [ -e '/usr/share/debconf/confmodule' ]; then
|
||||
db_purge
|
||||
fi
|
||||
|
||||
6
resources/linux/debian/templates.template
Normal file
6
resources/linux/debian/templates.template
Normal file
@@ -0,0 +1,6 @@
|
||||
Template: @@NAME@@/add-microsoft-repo
|
||||
Type: boolean
|
||||
Default: true
|
||||
Description: Add Microsoft apt repository for Visual Studio Code?
|
||||
The installer would like to add the Microsoft repository and signing
|
||||
key to update VS Code through apt.
|
||||
Reference in New Issue
Block a user