mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Remove all sudo
This commit is contained in:
parent
f206526487
commit
48fe8b8fac
3 changed files with 39 additions and 24 deletions
|
@ -66,3 +66,9 @@ ynh_backup "/etc/logrotate.d/$app" "${backup_dir}/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/cron.d/$app" "${backup_dir}/etc/cron.d/$app"
|
ynh_backup "/etc/cron.d/$app" "${backup_dir}/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE SERVICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup "/etc/systemd/system/$app.uwsgi.service" "${backup_dir}/etc/systemd/system/$app.uwsgi.service"
|
||||||
|
|
|
@ -110,10 +110,10 @@ ynh_system_user_create $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# PIP INSTALLATION
|
# PIP INSTALLATION
|
||||||
#=================================================
|
#=================================================
|
||||||
sudo su $app -c "virtualenv ${final_path}/venv"
|
virtualenv ${final_path}/venv
|
||||||
sudo source ${final_path}/venv/bin/activate
|
source ${final_path}/venv/bin/activate
|
||||||
sudo pip install Weblate==2.16
|
pip install Weblate==2.16
|
||||||
sudo pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns
|
pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -122,25 +122,25 @@ sudo pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Copy Files
|
# Copy Files
|
||||||
sudo cp ../conf/uwsgi.ini $final_path/uwsgi.ini
|
cp ../conf/uwsgi.ini $final_path/uwsgi.ini
|
||||||
ynh_replace_string "__NAME__" "$app" $final_path/uwsgi.ini
|
ynh_replace_string "__NAME__" "$app" $final_path/uwsgi.ini
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" $final_path/uwsgi.ini
|
ynh_replace_string "__FINALPATH__" "$final_path" $final_path/uwsgi.ini
|
||||||
|
|
||||||
# Config service
|
# Config service
|
||||||
sudo mkdir -p /etc/uwsgi/apps-enabled/
|
mkdir -p /etc/uwsgi/apps-enabled/
|
||||||
sudo ln -s $final_path/uwsgi.ini /etc/uwsgi/apps-enabled/$app.uwsgi.ini
|
ln -s $final_path/uwsgi.ini /etc/uwsgi/apps-enabled/$app.uwsgi.ini
|
||||||
|
|
||||||
sudo cp ../conf/uwsgi_service /etc/systemd/system/$app.uwsgi.service
|
cp ../conf/uwsgi_service /etc/systemd/system/$app.uwsgi.service
|
||||||
ynh_replace_string "__NAME__" "$app" /etc/systemd/system/$app.uwsgi.service
|
ynh_replace_string "__NAME__" "$app" /etc/systemd/system/$app.uwsgi.service
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/systemd/system/$app.uwsgi.service
|
ynh_replace_string "__FINALPATH__" "$final_path" /etc/systemd/system/$app.uwsgi.service
|
||||||
|
|
||||||
|
|
||||||
# Start service
|
# Start service
|
||||||
sudo systemctl enable $app.uwsgi.service
|
systemctl enable $app.uwsgi.service
|
||||||
sudo systemctl restart $app.uwsgi.service
|
systemctl restart $app.uwsgi.service
|
||||||
|
|
||||||
# Add weblate.uwsgi as a service
|
# Add weblate.uwsgi as a service
|
||||||
sudo yunohost service add $app.service
|
yunohost service add $app.service
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP settings.py
|
# SPECIFIC SETUP settings.py
|
||||||
|
@ -151,8 +151,8 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
admin_mail="$(ynh_user_get_info $admin mail)"
|
admin_mail="$(ynh_user_get_info $admin mail)"
|
||||||
key=$(ynh_string_random 64)
|
key=$(ynh_string_random 64)
|
||||||
|
|
||||||
sudo cp $final_path/weblate/settings_example.py $final_path/weblate/settings.py
|
cp $final_path/weblate/settings_example.py $final_path/weblate/settings.py
|
||||||
sudo cp ../conf/settings.py $final_path/weblate/settings.py
|
cp ../conf/settings.py $final_path/weblate/settings.py
|
||||||
|
|
||||||
ynh_replace_string "__NAME__" "$app" $final_path/weblate/settings.py
|
ynh_replace_string "__NAME__" "$app" $final_path/weblate/settings.py
|
||||||
ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/weblate/settings.py
|
ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/weblate/settings.py
|
||||||
|
@ -168,15 +168,15 @@ ynh_replace_string "__KEY__" "$key" $final_path/weblate/settings.py
|
||||||
#==========================================
|
#==========================================
|
||||||
|
|
||||||
# set up database
|
# set up database
|
||||||
sudo $final_path/manage.py migrate --noinput
|
$final_path/manage.py migrate --noinput
|
||||||
# generate static files
|
# generate static files
|
||||||
sudo $final_path/manage.py collectstatic --noinput
|
$final_path/manage.py collectstatic --noinput
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP CRON
|
# SETUP CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sudo cp ../conf/cron_weblate /etc/cron.d/$app
|
cp ../conf/cron_weblate /etc/cron.d/$app
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
|
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -193,7 +193,7 @@ ynh_store_file_checksum "$final_path/CONFIG_FILE"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
sudo chown -R root: $final_path
|
chown -R root: $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
|
|
@ -84,11 +84,19 @@ chown -R root: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies python-django translate-toolkit \
|
ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \
|
||||||
python-whoosh python-pil python-libravatar \
|
libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv
|
||||||
python-babel git mercurial \
|
|
||||||
python-django-compressor python-django-crispy-forms \
|
virtualenv ${final_path}/venv
|
||||||
python-djangorestframework python-dateutil
|
source ${final_path}/venv/bin/activate
|
||||||
|
pip install Weblate==2.16
|
||||||
|
pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE SERVICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/systemd/system/$app.uwsgi.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
@ -103,7 +111,7 @@ yunohost service add $app --log "/var/log/$app/APP.log"
|
||||||
ynh_restore_file "/etc/cron.d/$app"
|
ynh_restore_file "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/logrotate.d/$app"
|
ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
|
@ -111,7 +119,8 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX & uwsgi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
systemctl reload $app.uwsgi.service
|
||||||
|
|
Loading…
Reference in a new issue