mirror of
https://github.com/YunoHost-Apps/minetest_ynh.git
synced 2024-09-03 20:36:00 +02:00
Update install & remove scripts (add pinning)
This commit is contained in:
parent
f3d5630f64
commit
1cd3d9fc08
3 changed files with 46 additions and 40 deletions
3
conf/minetest-preferences
Normal file
3
conf/minetest-preferences
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Package: minetest-server minetest-data
|
||||||
|
Pin: release a=__CODENAME__-backports
|
||||||
|
Pin-Priority: 900
|
|
@ -13,18 +13,18 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
# MANAGE FAILURE OF THE SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
pvp=$YNH_APP_ARG_PVP
|
pvp=$YNH_APP_ARG_PVP
|
||||||
creative=$YNH_APP_ARG_CREATIVE
|
|
||||||
damage=$YNH_APP_ARG_DAMAGE
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
damage=$YNH_APP_ARG_DAMAGE
|
||||||
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
creative=$YNH_APP_ARG_CREATIVE
|
||||||
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE DEBIAN'S CODENAME
|
# CHECK THE DEBIAN'S CODENAME
|
||||||
|
@ -41,17 +41,17 @@ test -z "$codename" && (ynh_die "codename empty")
|
||||||
|
|
||||||
port=$(ynh_find_port 30000) # Cherche un port libre.
|
port=$(ynh_find_port 30000) # Cherche un port libre.
|
||||||
|
|
||||||
# Ouvre les ports dans le firewall
|
# Open ports in firewall
|
||||||
ALL_QUIET sudo yunohost firewall allow UDP $port
|
ALL_QUIET yunohost firewall allow UDP $port
|
||||||
ALL_QUIET sudo yunohost firewall allow TCP $port
|
ALL_QUIET yunohost firewall allow TCP $port
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set $app port $port
|
||||||
|
|
||||||
# Enregistre les infos dans la config YunoHost
|
# Store informations in Yunohost config
|
||||||
ynh_app_setting_set $app domain ${domain}
|
|
||||||
ynh_app_setting_set $app is_public ${is_public}
|
|
||||||
ynh_app_setting_set $app pvp ${pvp}
|
ynh_app_setting_set $app pvp ${pvp}
|
||||||
ynh_app_setting_set $app creative ${creative}
|
|
||||||
ynh_app_setting_set $app damage ${damage}
|
ynh_app_setting_set $app damage ${damage}
|
||||||
|
ynh_app_setting_set $app domain ${domain}
|
||||||
|
ynh_app_setting_set $app creative ${creative}
|
||||||
|
ynh_app_setting_set $app is_public ${is_public}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -60,48 +60,49 @@ ynh_app_setting_set $app damage ${damage}
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Installation du paquet minetest et ses dépendances
|
# Installation du paquet minetest et ses dépendances
|
||||||
ynh_replace_string "__CODENAME__" "$codename" ../conf/minetest.list
|
cp -a "../conf/minetest.list" "/etc/apt/sources.list.d/$app.list"
|
||||||
sudo cp -a ../conf/minetest.list /etc/apt/sources.list.d/
|
ynh_replace_string "__CODENAME__" "$codename" "/etc/apt/sources.list.d/$app.list"
|
||||||
|
cp -a "../conf/minetest-preferences" "/etc/apt/preferences.d/00MinetestPinning"
|
||||||
|
ynh_replace_string "__CODENAME__" "$codename" "/etc/apt/preferences.d/00MinetestPinning"
|
||||||
if [ $(uname -m) == "armv7l" ]
|
if [ $(uname -m) == "armv7l" ]
|
||||||
then
|
then
|
||||||
gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010
|
gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010
|
||||||
gpg -a --export 7638D0442B90D010 | sudo apt-key add -
|
gpg -a --export 7638D0442B90D010 | apt-key add -
|
||||||
fi
|
fi
|
||||||
sudo apt-get update
|
ynh_package_update
|
||||||
sudo apt-get -qq -t $codename-backports -y install minetest-server
|
ynh_install_app_dependencies minetest-server
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENABLE SERVICE IN ADMIN PANEL
|
# ENABLE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Ajoute le service au monitoring de Yunohost.
|
# Add service to Yunohost's monitoring
|
||||||
sudo yunohost service add minetest --log "/var/log/minetest/minetest.log"
|
yunohost service add minetest --log "/var/log/minetest/minetest.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE MINETEST
|
# CONFIGURE MINETEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Modifie la configuration de minetest
|
cp "../conf/minetest.conf" "/etc/minetest/minetest.conf"
|
||||||
ynh_replace_string "__PORT__" "$port" ../conf/minetest.conf
|
chown root:root /etc/minetest/minetest.conf
|
||||||
|
chmod 644 /etc/minetest/minetest.conf
|
||||||
|
|
||||||
|
# Change Minetest configuration
|
||||||
|
ynh_replace_string "__PORT__" "$port" /etc/minetest/minetest.conf
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_replace_string "__ANNOUNCE__" "true" ../conf/minetest.conf
|
ynh_replace_string "__ANNOUNCE__" "true" /etc/minetest/minetest.conf
|
||||||
else
|
else
|
||||||
ynh_replace_string "__ANNOUNCE__" "false" ../conf/minetest.conf
|
ynh_replace_string "__ANNOUNCE__" "false" /etc/minetest/minetest.conf
|
||||||
fi
|
fi
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" ../conf/minetest.conf
|
ynh_replace_string "__DOMAIN__" "$domain" /etc/minetest/minetest.conf
|
||||||
ynh_replace_string "__PVP__" "$pvp" ../conf/minetest.conf
|
ynh_replace_string "__PVP__" "$pvp" /etc/minetest/minetest.conf
|
||||||
ynh_replace_string "__CREATIVE__" "$creative" ../conf/minetest.conf
|
ynh_replace_string "__CREATIVE__" "$creative" /etc/minetest/minetest.conf
|
||||||
ynh_replace_string "__DAMAGE__" "$damage" ../conf/minetest.conf
|
ynh_replace_string "__DAMAGE__" "$damage" /etc/minetest/minetest.conf
|
||||||
sudo cp ../conf/minetest.conf /etc/minetest/minetest.conf
|
|
||||||
sudo chown root:root /etc/minetest/minetest.conf
|
|
||||||
sudo chmod 644 /etc/minetest/minetest.conf
|
|
||||||
|
|
||||||
ynh_store_checksum_config "/etc/minetest/minetest.conf" # Enregistre la somme de contrôle du fichier de config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART MINETEST'S SERVICE
|
# RESTART MINETEST'S SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Redémarre minetest pour prendre en compte la nouvelle configuration
|
# Restart Minetest to use new settings
|
||||||
sudo systemctl restart minetest-server
|
systemctl restart minetest-server
|
||||||
|
|
|
@ -24,10 +24,10 @@ port=$(ynh_app_setting_get $app port)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Retire le service du monitoring de Yunohost.
|
# Retire le service du monitoring de Yunohost.
|
||||||
if sudo yunohost service status | grep -q minetest # Test l'existence du service dans Yunohost
|
if yunohost service status | grep -q minetest # Test l'existence du service dans Yunohost
|
||||||
then
|
then
|
||||||
echo "Remove minetest service"
|
echo "Remove minetest service"
|
||||||
sudo yunohost service remove minetest
|
yunohost service remove minetest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -35,8 +35,8 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Ferme les ports dans le firewall
|
# Ferme les ports dans le firewall
|
||||||
ALL_QUIET sudo yunohost firewall disallow UDP $port
|
ALL_QUIET yunohost firewall disallow UDP $port
|
||||||
ALL_QUIET sudo yunohost firewall disallow TCP $port
|
ALL_QUIET yunohost firewall disallow TCP $port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
|
@ -47,6 +47,8 @@ ALL_QUIET sudo yunohost firewall disallow TCP $port
|
||||||
# Suppression du paquet minetest
|
# Suppression du paquet minetest
|
||||||
if [ -e "/usr/lib/minetest/minetestserver" ]; then
|
if [ -e "/usr/lib/minetest/minetestserver" ]; then
|
||||||
echo "Remove minetest package"
|
echo "Remove minetest package"
|
||||||
sudo apt-get -y purge minetest-server minetest-data
|
ynh_remove_app_dependencies
|
||||||
fi
|
fi
|
||||||
ynh_secure_remove "/etc/apt/sources.list.d/minetest.list"
|
ynh_secure_remove "/etc/apt/sources.list.d/$app.list"
|
||||||
|
ynh_secure_remove "/etc/apt/preferences.d/00MinetestPinning"
|
||||||
|
ynh_package_update
|
||||||
|
|
Loading…
Add table
Reference in a new issue