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.
This commit is contained in:
Julian Andres Klode
2017-10-03 18:42:17 +02:00
parent d86955c7e8
commit e073e848d7

View File

@@ -24,17 +24,11 @@ if [ "@@NAME@@" != "code-oss" ]; then
fi
# Register apt repository
get_apt_config_value() {
echo $(apt-config dump | grep "$1 " | sed -e "s/$1 \"//" -e "s/\";$//")
}
eval $(apt-config shell APT_SOURCE_PARTS Dir::Etc::sourceparts/d)
CODE_SOURCE_PART=${APT_SOURCE_PARTS}vscode.list
APT_DIR=$(get_apt_config_value Dir)
APT_ETC=$APT_DIR$(get_apt_config_value Dir::Etc)
APT_SOURCE_PARTS=$APT_ETC/$(get_apt_config_value Dir::Etc::sourceparts)
CODE_SOURCE_PART=$APT_SOURCE_PARTS/vscode.list
APT_TRUSTED_PARTS=$APT_ETC/$(get_apt_config_value Dir::Etc::trustedparts)
CODE_TRUSTED_PART=$APT_TRUSTED_PARTS/microsoft.gpg
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