mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
systemd: Convert services (SySv init) to systemctl (systemd) commands
This commit is contained in:
parent
bcd9337764
commit
428e5d789f
5 changed files with 21 additions and 19 deletions
|
@ -47,6 +47,6 @@ This app works with a non-stable version of YunoHost.
|
||||||
|
|
||||||
Until this version is available (coming soon!) as an official stable release, you need to execute some commands before installing this app:
|
Until this version is available (coming soon!) as an official stable release, you need to execute some commands before installing this app:
|
||||||
|
|
||||||
# service bind9 stop
|
# systemctl stop bind9
|
||||||
# update-rc.d bind9 remove
|
# systemctl disable bind9
|
||||||
# apt-get install dnsmasq
|
# apt-get install dnsmasq
|
||||||
|
|
|
@ -89,7 +89,7 @@ is_dhcpd4_running() {
|
||||||
}
|
}
|
||||||
|
|
||||||
is_hostapd_running() {
|
is_hostapd_running() {
|
||||||
service hostapd status &> /dev/null
|
systemctl is-active hostapd --quiet &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
is_running() {
|
is_running() {
|
||||||
|
@ -218,7 +218,7 @@ start_hostapd() {
|
||||||
rm /etc/hostapd/hostapd.conf.tmp
|
rm /etc/hostapd/hostapd.conf.tmp
|
||||||
done
|
done
|
||||||
|
|
||||||
service hostapd start
|
systemctl start hostapd --quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
## Unsetters
|
## Unsetters
|
||||||
|
@ -269,7 +269,7 @@ stop_dhcpd4() {
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_hostapd() {
|
stop_hostapd() {
|
||||||
service hostapd stop
|
systemctl stop hostapd --quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
@ -317,7 +317,7 @@ if [ "$1" != restart ]; then
|
||||||
# Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
|
# Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
|
||||||
if [ ! -e /tmp/.ynh-hotspot-boot ]; then
|
if [ ! -e /tmp/.ynh-hotspot-boot ]; then
|
||||||
touch /tmp/.ynh-hotspot-boot
|
touch /tmp/.ynh-hotspot-boot
|
||||||
service php5-fpm restart
|
systemctl restart php5-fpm --quiet
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
@ -499,7 +499,7 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if has_vpnclient_app; then
|
if has_vpnclient_app; then
|
||||||
service ynh-vpnclient start
|
systemctl start ynh-vpnclient --quiet
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
|
|
|
@ -39,10 +39,10 @@ if [ "${ynh_version}" -lt 220 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo service dnsmasq status &> /dev/null
|
sudo systemctl status dnsmasq status --quiet &> /dev/null
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR: You need to enable dnsmasq instead of bind9 (apt-get remove bind9 && service dnsmasq start)"
|
echo "ERROR: You need to enable dnsmasq instead of bind9 (apt-get remove bind && systemctl start dnsmasq)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ sudo sed 's|<TPL:NGINX_REALPATH>|/var/www/wifiadmin/|g' -i /etc/php5/fpm/pool.d/
|
||||||
sudo sed "s|<TPL:NGINX_LOCATION>|${url_path}|g" -i /var/www/wifiadmin/config.php
|
sudo sed "s|<TPL:NGINX_LOCATION>|${url_path}|g" -i /var/www/wifiadmin/config.php
|
||||||
|
|
||||||
# Copy init script
|
# Copy init script
|
||||||
sudo install -o root -g root -m 0755 ../conf/init_ynh-hotspot /etc/init.d/ynh-hotspot
|
sudo install -o root -g root -m 0755 ../conf/ynh-hotspot.service /lib/systemd/system/ynh-hotspot.service
|
||||||
|
|
||||||
# Update firewall for DHCP
|
# Update firewall for DHCP
|
||||||
sudo yunohost firewall allow --no-upnp --ipv6 UDP 547
|
sudo yunohost firewall allow --no-upnp --ipv6 UDP 547
|
||||||
|
@ -208,7 +208,7 @@ sudo yunohost service disable hostapd
|
||||||
sudo yunohost service add php5-fpm
|
sudo yunohost service add php5-fpm
|
||||||
sudo yunohost service enable php5-fpm
|
sudo yunohost service enable php5-fpm
|
||||||
|
|
||||||
sudo service nginx reload
|
sudo systemcld reload nginx
|
||||||
|
|
||||||
# Remove IPv6 address set if there is a VPN installed
|
# Remove IPv6 address set if there is a VPN installed
|
||||||
if [ "${ip6_addr}" != none ]; then
|
if [ "${ip6_addr}" != none ]; then
|
||||||
|
@ -220,7 +220,8 @@ fi
|
||||||
|
|
||||||
sudo yunohost service add ynh-hotspot
|
sudo yunohost service add ynh-hotspot
|
||||||
sudo yunohost service enable ynh-hotspot
|
sudo yunohost service enable ynh-hotspot
|
||||||
sudo service ynh-hotspot start
|
sudo systemctl reenable ynh-hotspot
|
||||||
|
sudo systemcld start ynh-hotspot
|
||||||
|
|
||||||
# Update SSO for wifiadmin
|
# Update SSO for wifiadmin
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
domain=$(sudo yunohost app setting hotspot domain)
|
domain=$(sudo yunohost app setting hotspot domain)
|
||||||
|
|
||||||
# The End
|
# The End
|
||||||
sudo service ynh-hotspot stop
|
sudo systemctl stop ynh-hotspot
|
||||||
sudo yunohost service remove ynh-hotspot
|
sudo yunohost service remove ynh-hotspot
|
||||||
sudo rm -f /etc/init.d/ynh-hotspot
|
sudo systemctl disable ynh-hotspot
|
||||||
|
sudo rm -f /lib/systemd/system/ynh-hotspot.service
|
||||||
sudo rm -f /tmp/.ynh-hotspot-*
|
sudo rm -f /tmp/.ynh-hotspot-*
|
||||||
|
|
||||||
# Update firewall for DHCP
|
# Update firewall for DHCP
|
||||||
|
@ -43,7 +44,7 @@ sudo rm -f /lib/firmware/htc-9271.fw
|
||||||
# Restart services
|
# Restart services
|
||||||
sudo yunohost service stop php5-fpm
|
sudo yunohost service stop php5-fpm
|
||||||
sudo yunohost service start php5-fpm
|
sudo yunohost service start php5-fpm
|
||||||
sudo service nginx reload
|
sudo systemctl reload nginx
|
||||||
|
|
||||||
# Remove sources
|
# Remove sources
|
||||||
sudo rm -rf /var/www/wifiadmin/
|
sudo rm -rf /var/www/wifiadmin/
|
||||||
|
|
|
@ -27,23 +27,23 @@ function moulinette_set($var, $value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop_service() {
|
function stop_service() {
|
||||||
exec('sudo service ynh-hotspot stop');
|
exec('sudo systemctl stop ynh-hotspot');
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_service() {
|
function start_service() {
|
||||||
exec('sudo service ynh-hotspot start', $output, $retcode);
|
exec('sudo systemctl start ynh-hotspot', $output, $retcode);
|
||||||
|
|
||||||
return $retcode;
|
return $retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function service_status() {
|
function service_status() {
|
||||||
exec('sudo service ynh-hotspot status', $output);
|
exec('sudo systemctl is-active ynh-hotspot', $output);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function service_faststatus() {
|
function service_faststatus() {
|
||||||
exec('sudo service hostapd status', $output, $retcode);
|
exec('sudo systemctl is-active hostapd', $output, $retcode);
|
||||||
|
|
||||||
return $retcode;
|
return $retcode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue