1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/codimd_ynh.git synced 2024-09-03 18:16:32 +02:00

Update ynh_add_extra_apt_repos__3

This commit is contained in:
liberodark 2019-11-28 10:29:31 +01:00 committed by GitHub
parent d03bc6b275
commit d17dacc5d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,7 +27,7 @@ ynh_pin_repo () {
name="${name:-$app}"
append=${append:-0}
if [ $append -eq 1 ]
if [ "$append" -eq 1 ]
then
append="tee -a"
else
@ -128,7 +128,7 @@ ynh_install_extra_repo () {
local component="${repo##$uri $suite }"
# Add the repository into sources.list.d
ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append
ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" "$append"
# Pin the new repo with the default priority, so it won't be used for upgrades.
# Build $pin from the uri without http and any sub path
@ -139,13 +139,13 @@ ynh_install_extra_repo () {
then
priority="--priority=$priority"
fi
ynh_pin_repo --package="*" --pin="origin \"$pin\"" $priority --name="$name" $append
ynh_pin_repo --package="*" --pin="origin \"$pin\"" "$priority" --name="$name" "$append"
# Get the public key for the repo
if [ -n "$key" ]
then
mkdir -p "/etc/apt/trusted.gpg.d"
wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.gpg > /dev/null
wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/"$name".gpg > /dev/null
fi
# Update the list of package with the new repo
@ -200,13 +200,13 @@ ynh_install_extra_app_dependencies () {
key="--key=$key"
fi
# Add an extra repository for those packages
ynh_install_extra_repo --repo="$repo" $key --priority=995 --name=$name
ynh_install_extra_repo --repo="$repo" "$key" --priority=995 --name="$name"
# Install requested dependencies from this extra repository.
ynh_add_app_dependencies --package="$package"
# Remove this extra repository after packages are installed
ynh_remove_extra_repo --name=$app
ynh_remove_extra_repo --name="$app"
}
#=================================================
@ -252,7 +252,7 @@ ynh_install_app_dependencies () {
dependencies="$(echo "$dependencies" | sed 's/\([^(\<=\>]\)\([\<=\>]\+\)\([^,]\+\)/\1 (\2 \3)/g')"
fi
cat > /tmp/${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build
cat > /tmp/"${dep_app}"-ynh-deps.control << EOF # Make a control file for equivs-build
Section: misc
Priority: optional
Package: ${dep_app}-ynh-deps
@ -262,10 +262,10 @@ Architecture: all
Description: Fake package for $app (YunoHost app) dependencies
This meta-package is only responsible of installing its dependencies.
EOF
ynh_package_install_from_equivs /tmp/${dep_app}-ynh-deps.control \
ynh_package_install_from_equivs /tmp/"${dep_app}"-ynh-deps.control \
|| ynh_die --message="Unable to install dependencies" # Install the fake package and its dependencies
rm /tmp/${dep_app}-ynh-deps.control
ynh_app_setting_set --app=$app --key=apt_dependencies --value="$dependencies"
rm /tmp/"${dep_app}"-ynh-deps.control
ynh_app_setting_set --app="$app" --key=apt_dependencies --value="$dependencies"
}
ynh_add_app_dependencies () {
@ -279,12 +279,12 @@ ynh_add_app_dependencies () {
replace=${replace:-0}
local current_dependencies=""
if [ $replace -eq 0 ]
if [ "$replace" -eq 0 ]
then
local dep_app=${app//_/-} # Replace all '_' by '-'
if ynh_package_is_installed --package="${dep_app}-ynh-deps"
then
current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) "
current_dependencies="$(dpkg-query --show --showformat='${Depends}' "${dep_app}"-ynh-deps) "
fi
current_dependencies=${current_dependencies// | /|}