Skip to content

Commit e073e84

Browse files
committed
Correctly get apt dirs in debian postinst
This previously used some crazy hack to parse the output of `apt-config dump`, instead of using `apt-config shell` like you are supposed to do.
1 parent d86955c commit e073e84

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

resources/linux/debian/postinst.template

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@ if [ "@@NAME@@" != "code-oss" ]; then
2424
fi
2525

2626
# Register apt repository
27-
get_apt_config_value() {
28-
echo $(apt-config dump | grep "$1 " | sed -e "s/$1 \"//" -e "s/\";$//")
29-
}
27+
eval $(apt-config shell APT_SOURCE_PARTS Dir::Etc::sourceparts/d)
28+
CODE_SOURCE_PART=${APT_SOURCE_PARTS}vscode.list
3029

31-
APT_DIR=$(get_apt_config_value Dir)
32-
APT_ETC=$APT_DIR$(get_apt_config_value Dir::Etc)
33-
APT_SOURCE_PARTS=$APT_ETC/$(get_apt_config_value Dir::Etc::sourceparts)
34-
CODE_SOURCE_PART=$APT_SOURCE_PARTS/vscode.list
35-
36-
APT_TRUSTED_PARTS=$APT_ETC/$(get_apt_config_value Dir::Etc::trustedparts)
37-
CODE_TRUSTED_PART=$APT_TRUSTED_PARTS/microsoft.gpg
30+
eval $(apt-config shell APT_TRUSTED_PARTS Dir::Etc::trustedparts/d)
31+
CODE_TRUSTED_PART=${APT_TRUSTED_PARTS}microsoft.gpg
3832

3933
# Sourced from https://packages.microsoft.com/keys/microsoft.asc
4034
if [ ! -f $CODE_TRUSTED_PART ]; then

0 commit comments

Comments
 (0)