1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/motioneye_ynh.git synced 2024-09-03 19:46:09 +02:00
motioneye_ynh/scripts/restore
Carlos Orama c3dcb5dcbc
Installation Tests (#11)
* fixed config destination typo

* $final_path not bound, attepting "__APP__"

* test: hard Coded directory

* changed install and data dir references

* I thought I had replaced etc/ with /etc

* added python3-venv to dependencies

* moved asset to install

* undo source removal

* debug: list all files in install dir

* use local downloaded dev.tar.gz

* update source reference to specific commit + no extract

* updated manifest for fixes and info + systemd correct directory

* Auto-update README

* Update manifest.toml (Fixed CPE)

Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com>

* Version to date ver

Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com>

* Auto-update README

* install: changed permissions

* 660->664

* install: 664->666 chown commented

* chown+777 (this does not feel right)

* following motionEye's base (664 + motion:motion)

* Auto-update README

* moved permissions

* add motion to dependencies

* permission tests continue

* 777 again

* retry

* reordered folder making

* Linter (#12) by ericgaspar

* linter

* Auto-update README

* Update LICENSE

* Update manifest.toml

* Auto-update README

* Update manifest.toml

* cleaning

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update README

* v0.43.1b1 download test

* fixed miss-quote

* Auto-update README

* Update manifest.toml

* clean up?

* __APP__ -> $app

* venv, ip fix and ram fix

* run directory

* test install dir run

* logs in app dir (should change later)

* force-create directories (shouldn't these be made?)

* updated folders, upgrade, restore and install usage

* corrected directory references

* what if we cant use /path?

* fixed description

* Auto-update README

* minimized screenshot to be less than 512k

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com>
Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com>
2024-01-17 14:09:30 +00:00

74 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$install_dir"
chown -R $app:www-data "$install_dir"
pushd $install_dir
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install source.tar.gz
popd
# pid dir
mkdir -p $install_dir/run
chown $app:$app $install_dir/run
chmod 664 $install_dir/run
# logs dir
mkdir -p $install_dir/logs
chown $app:$app $install_dir/logs
chmod 664 $install_dir/logs
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
# (Same as for install dir)
chown -R $app:www-data "$data_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
yunohost service add $app --description="Web frontend for the motion daemon" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last