|
@@ -18,18 +18,25 @@
|
|
|
# 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/>.
|
|
|
|
|
|
+# This is an upgrade?
|
|
|
+upgrade=$([ "$TORCLIENT_UPGRADE" == 1 ] && echo true || echo false)
|
|
|
+
|
|
|
# Retrieve arguments
|
|
|
domain=${1}
|
|
|
url_path=${2}
|
|
|
|
|
|
-# Check domain/path availability
|
|
|
-sudo yunohost app checkurl ${domain}${url_path} -a torclient
|
|
|
-if [ ! $? -eq 0 ]; then
|
|
|
- exit 1
|
|
|
-fi
|
|
|
+if ! $upgrade; then
|
|
|
+
|
|
|
+ # Check domain/path availability
|
|
|
+ sudo yunohost app checkurl ${domain}${url_path} -a torclient
|
|
|
+ if [ ! $? -eq 0 ]; then
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+
|
|
|
+ if [ ! -e /tmp/.ynh-hotspot-started ]; then
|
|
|
+ echo "WARNING: Hotspot app not installed or not started" >&2
|
|
|
+ fi
|
|
|
|
|
|
-if [ ! -e /tmp/.ynh-hotspot-started ]; then
|
|
|
- echo "hotspot not started and/or not installed"
|
|
|
fi
|
|
|
|
|
|
echo 'deb http://deb.torproject.org/torproject.org jessie main' | sudo tee "/etc/apt/sources.list.d/torproject.list"
|
|
@@ -42,9 +49,13 @@ packages='tor php5-fpm'
|
|
|
sudo apt-get update
|
|
|
DEBIAN_FRONTEND=noninteractive sudo apt-get --assume-yes --force-yes install ${packages}
|
|
|
|
|
|
-# Save arguments
|
|
|
-sudo yunohost app setting torclient service_enabled -v 0
|
|
|
-sudo yunohost app setting torclient wifi_device_id -v -1
|
|
|
+if ! $upgrade; then
|
|
|
+
|
|
|
+ # Save arguments
|
|
|
+ sudo yunohost app setting torclient service_enabled -v 0
|
|
|
+ sudo yunohost app setting torclient wifi_device_id -v -1
|
|
|
+
|
|
|
+fi
|
|
|
|
|
|
sudo install -o root -g root -m 0644 ../conf/torrc /etc/tor/torrc.tpl
|
|
|
sudo install -b -o root -g root -m 0644 ../conf/nginx_torclient.conf "/etc/nginx/conf.d/${domain}.d/torclient.conf"
|
|
@@ -94,11 +105,14 @@ sudo systemctl restart php5-fpm
|
|
|
sudo systemctl reload nginx
|
|
|
|
|
|
sudo systemctl enable ynh-torclient
|
|
|
-sudo systemctl start ynh-torclient
|
|
|
|
|
|
-# Update SSO for torclient
|
|
|
-sudo yunohost app ssowatconf
|
|
|
+if ! $upgrade; then
|
|
|
+ sudo systemctl start ynh-torclient
|
|
|
|
|
|
-echo "WARNING: Tor Client is not started because you need to define an associated wifi hotspot through the web admin" >&2
|
|
|
+ sudo yunohost service add ynh-torclient
|
|
|
+ sudo yunohost app ssowatconf
|
|
|
+
|
|
|
+ echo "WARNING: Tor Client is not started because you need to define an associated wifi hotspot through the web admin" >&2
|
|
|
+fi
|
|
|
|
|
|
exit 0
|