|
@@ -1,13 +1,21 @@
|
|
|
#!/bin/bash
|
|
|
-### BEGIN INIT INFO
|
|
|
-# Provides: ynh-torclient
|
|
|
-# Required-Start: $network $remote_fs $syslog ynh-hotspot
|
|
|
-# Required-Stop: $network $remote_fs $syslog ynh-hotspot
|
|
|
-# Default-Start: 2 3 4 5
|
|
|
-# Default-Stop: 0 1 6
|
|
|
-# Short-Description: Set prerequisites for wifi torclient.
|
|
|
-# Description: Set prerequisites for wifi torclient.
|
|
|
-### END INIT INFO
|
|
|
+
|
|
|
+# TOR Client app for YunoHost
|
|
|
+# Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
|
|
+# Contribute at https://github.com/jvaubourg/torclient_ynh
|
|
|
+#
|
|
|
+# This program is free software: you can redistribute it and/or modify
|
|
|
+# it under the terms of the GNU Affero General Public License as published by
|
|
|
+# the Free Software Foundation, either version 3 of the License, or
|
|
|
+# (at your option) any later version.
|
|
|
+#
|
|
|
+# This program is distributed in the hope that it will be useful,
|
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+# GNU Affero General Public License for more details.
|
|
|
+#
|
|
|
+# You should have received a copy of the GNU Affero General Public License
|
|
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
# Functions
|
|
|
## State functions
|
|
@@ -25,7 +33,7 @@ is_nat_set() {
|
|
|
}
|
|
|
|
|
|
is_tor_running() {
|
|
|
- service tor status &> /dev/null
|
|
|
+ systemctl is-active tor --quiet &> /dev/null
|
|
|
}
|
|
|
|
|
|
is_running() {
|
|
@@ -50,7 +58,7 @@ unset_nat() {
|
|
|
}
|
|
|
|
|
|
stop_tor() {
|
|
|
- service tor stop &> /dev/null
|
|
|
+ systemctl stop tor --quiet &> /dev/null
|
|
|
}
|
|
|
|
|
|
start_tor() {
|
|
@@ -58,7 +66,7 @@ start_tor() {
|
|
|
|
|
|
sed "s|<TPL:TOR_NETWORK>|${ynh_wifi_prefix}|g" -i /etc/tor/torrc
|
|
|
|
|
|
- service tor start
|
|
|
+ systemctl start tor --quiet
|
|
|
}
|
|
|
|
|
|
## Tools
|
|
@@ -99,7 +107,7 @@ moulinette_hotspot_get() {
|
|
|
fi
|
|
|
|
|
|
echo "${value}"
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
do_start() {
|
|
|
if is_running; then
|
|
@@ -174,7 +182,7 @@ do_status() {
|
|
|
# Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
|
|
|
if [ ! -e /tmp/.ynh-torclient-boot ]; then
|
|
|
touch /tmp/.ynh-torclient-boot
|
|
|
- service php5-fpm restart
|
|
|
+ systemctl restart php5-fpm --quiet
|
|
|
fi
|
|
|
|
|
|
# Variables
|