mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
[mod] #51: remove no longer neccessary sudo
This commit is contained in:
parent
5dc4d3b259
commit
3e379d9fa8
4 changed files with 25 additions and 25 deletions
|
@ -15,19 +15,19 @@ url="${git_repo}${middle_url}${deb}"
|
||||||
# Retrieve debian package and install it
|
# Retrieve debian package and install it
|
||||||
wget -nc --quiet $url -P /tmp
|
wget -nc --quiet $url -P /tmp
|
||||||
deb_path="/tmp/$deb"
|
deb_path="/tmp/$deb"
|
||||||
sudo dpkg -i $deb_path > /dev/null
|
dpkg -i $deb_path > /dev/null
|
||||||
sudo rm -f $deb_path
|
rm -f $deb_path
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIGURE_DUNITER () {
|
CONFIGURE_DUNITER () {
|
||||||
sudo duniter config --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 80 --noupnp
|
duniter config --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 80 --noupnp
|
||||||
sudo duniter config --addep "BMAS $domain 443"
|
duniter config --addep "BMAS $domain 443"
|
||||||
sudo duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-noupnp
|
duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-noupnp
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG_SSOWAT () {
|
CONFIG_SSOWAT () {
|
||||||
# Add admin to the allowed users
|
# Add admin to the allowed users
|
||||||
sudo yunohost app addaccess $app -u $admin
|
yunohost app addaccess $app -u $admin
|
||||||
|
|
||||||
# Protect senstive sub-routes
|
# Protect senstive sub-routes
|
||||||
ynh_app_setting_set "$app" protected_uris "/webui","/webmin"
|
ynh_app_setting_set "$app" protected_uris "/webui","/webmin"
|
||||||
|
@ -42,19 +42,19 @@ ynh_app_setting_set "$app" redirected_urls "{'$domain/':'$domain/webui'}"
|
||||||
CONFIG_NGINX () {
|
CONFIG_NGINX () {
|
||||||
# Configure Nginx
|
# Configure Nginx
|
||||||
nginx_conf="../conf/nginx.conf"
|
nginx_conf="../conf/nginx.conf"
|
||||||
sudo sed -i "s@YNH_EXAMPLE_PORT@$port@" $nginx_conf
|
sed -i "s@YNH_EXAMPLE_PORT@$port@" $nginx_conf
|
||||||
sudo sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf
|
sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf
|
||||||
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
sudo service nginx reload
|
service nginx reload
|
||||||
}
|
}
|
||||||
|
|
||||||
REMOVE_DUNITER () {
|
REMOVE_DUNITER () {
|
||||||
# Stop duniter daemon if running
|
# Stop duniter daemon if running
|
||||||
sudo duniter status
|
duniter status
|
||||||
if [ `echo "$?"` == 0 ]; then
|
if [ `echo "$?"` == 0 ]; then
|
||||||
sudo duniter stop
|
duniter stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove Duniter package
|
# Remove Duniter package
|
||||||
sudo dpkg -r duniter
|
dpkg -r duniter
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@ source /usr/share/yunohost/helpers
|
||||||
source functions.sh
|
source functions.sh
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
|| ynh_die "Path not available: ${domain}${path}"
|
|| ynh_die "Path not available: ${domain}${path}"
|
||||||
|
|
||||||
# Check port availability
|
# Check port availability
|
||||||
sudo yunohost app checkport $port
|
yunohost app checkport $port
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
ynh_die "Port not available: ${port}"
|
ynh_die "Port not available: ${port}"
|
||||||
fi
|
fi
|
||||||
|
@ -42,19 +42,19 @@ ynh_app_setting_set $app arch $arch
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
ynh_app_setting_set "$app" admin "$admin"
|
||||||
|
|
||||||
# Open port on firewall
|
# Open port on firewall
|
||||||
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
|
yunohost firewall allow TCP $port > /dev/null 2>&1
|
||||||
|
|
||||||
INSTALL_DUNITER_DEBIAN_PACKAGE
|
INSTALL_DUNITER_DEBIAN_PACKAGE
|
||||||
CONFIGURE_DUNITER
|
CONFIGURE_DUNITER
|
||||||
|
|
||||||
# Reset Duniter node's existing data (blockchain, not conf)
|
# Reset Duniter node's existing data (blockchain, not conf)
|
||||||
sudo duniter reset data > /dev/null
|
duniter reset data > /dev/null
|
||||||
|
|
||||||
# Launch Duniter node
|
# Launch Duniter node
|
||||||
sudo duniter webstart
|
duniter webstart
|
||||||
|
|
||||||
# Add Duniter service to the YunoHost monitoring
|
# Add Duniter service to the YunoHost monitoring
|
||||||
sudo yunohost service add $app --log /root/.config/$app/"$app"_default/"$app".log
|
yunohost service add $app --log /root/.config/$app/"$app"_default/"$app".log
|
||||||
|
|
||||||
CONFIG_SSOWAT
|
CONFIG_SSOWAT
|
||||||
CONFIG_NGINX
|
CONFIG_NGINX
|
||||||
|
|
|
@ -14,14 +14,14 @@ port=$(ynh_app_setting_get $app port)
|
||||||
REMOVE_DUNITER
|
REMOVE_DUNITER
|
||||||
|
|
||||||
# Remove data and conf
|
# Remove data and conf
|
||||||
sudo rm -rf /root/.conf/duniter
|
rm -rf /root/.conf/duniter
|
||||||
|
|
||||||
# Remove Duniter service to YunoHost monitoring
|
# Remove Duniter service to YunoHost monitoring
|
||||||
sudo yunohost service remove $app
|
yunohost service remove $app
|
||||||
|
|
||||||
# Remove Nginx configuration
|
# Remove Nginx configuration
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
sudo service nginx reload
|
service nginx reload
|
||||||
|
|
||||||
# Close opened port
|
# Close opened port
|
||||||
sudo yunohost firewall disallow TCP $port
|
yunohost firewall disallow TCP $port
|
||||||
|
|
|
@ -19,7 +19,7 @@ INSTALL_DUNITER_DEBIAN_PACKAGE
|
||||||
CONFIGURE_DUNITER
|
CONFIGURE_DUNITER
|
||||||
|
|
||||||
# Start duniter daemon
|
# Start duniter daemon
|
||||||
sudo duniter webstart
|
duniter webstart
|
||||||
|
|
||||||
CONFIG_SSOWAT
|
CONFIG_SSOWAT
|
||||||
CONFIG_NGINX
|
CONFIG_NGINX
|
||||||
|
|
Loading…
Reference in a new issue