1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/tvheadend_ynh.git synced 2024-10-01 13:34:50 +02:00
tvheadend_ynh/scripts/_common.sh
2024-05-01 23:04:40 +02:00

34 lines
1 KiB
Bash

#!/bin/bash
_install_tvheadend_package() {
# Download the package
if [ ! -f "$install_dir/tvheadend.deb" ]; then
ynh_setup_source --dest_dir="$install_dir" --source_id="main_$YNH_DEBIAN_VERSION"
fi
# Pre-seed debconf database with answers of the interactive dpkg
echo tvheadend tvheadend/admin_password password "$password" | debconf-set-selections
echo tvheadend tvheadend/admin_username string "$superuser" | debconf-set-selections
echo tvheadend tvheadend/last_notes note | debconf-set-selections
# Install the package
ynh_package_install \
"$install_dir/tvheadend.deb"
chown -R "hts:video" "$data_dir"
# Mark packages as dependencies, to allow automatic removal
apt-mark auto tvheadend
# Prevent tvheadend being upgraded through apt…
apt-mark hold tvheadend
}
_uninstall_tvheadend_package() {
apt-mark unhold tvheadend
ynh_package_autopurge tvheadend
# Delete the system user created by the package
deluser hts --remove-home
}