Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions resources/linux/debian/postinst.template
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ if [ "@@NAME@@" != "code-oss" ]; then
db_get @@NAME@@/add-microsoft-repo || true
fi

# Determine whether to install the repository source list
# Determine whether to write the Microsoft repository source list
# 0 means do not write
# 1 means ask and then write if Yes
# 2 means write without asking
WRITE_SOURCE=0
if [ "$RET" = false ]; then
if [ "$CODE_INSTALL_WITH_REPO" = false ]; then
# The user does not want to add the Microsoft repository
WRITE_SOURCE=0
elif [ "$RET" = false ]; then
# The user does not want to add the Microsoft repository
WRITE_SOURCE=0
elif [ -f "$CODE_SOURCE_PART_DEB822" ]; then
Expand All @@ -59,11 +65,17 @@ if [ "@@NAME@@" != "code-oss" ]; then
elif apt-cache policy | grep -q "https://packages.microsoft.com/repos/code"; then
# The user is already on the new repository
WRITE_SOURCE=0
elif [ "$RET" = true ]; then
# User explicitly wants to add the Microsoft repository
WRITE_SOURCE=2
elif [ "$CODE_INSTALL_WITH_REPO" = true ]; then
# User explicitly wants to add the Microsoft repository
WRITE_SOURCE=2
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
# Source list 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
# Source list was disabled by OS upgrade
WRITE_SOURCE=1
fi

Expand Down