diff --git a/manifest.toml b/manifest.toml index 2e36f26..10675ec 100644 --- a/manifest.toml +++ b/manifest.toml @@ -23,7 +23,7 @@ multi_instance = true ldap = false sso = true disk = "500M" -ram.build = "512M" +ram.build = "256M" ram.runtime = "1024M" [install] @@ -60,6 +60,7 @@ ram.runtime = "1024M" [resources.install_dir] [resources.data_dir] + subdirs = ["logs", "media"] [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index 0891e50..b73ff4e 100755 --- a/scripts/install +++ b/scripts/install @@ -44,7 +44,7 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/motioneye.conf" --destination="/var/www/$app/motioneye.conf" +ynh_add_config --template="../conf/motioneye.conf" --destination="$install_dir/motioneye.conf" #================================================= # SETUP APPLICATION #================================================= @@ -57,17 +57,9 @@ pushd $install_dir popd # pid dir -mkdir -p /var/www/$app/run -chown $app:$app /var/www/$app/run -chmod 664 /var/www/$app/run - -# data dirs -mkdir -p /home/yunohost.app/$app/logs -chown $app:$app /home/yunohost.app/$app/logs -chmod 664 /home/yunohost.app/$app/logs -mkdir -p /home/yunohost.app/$app/media -chown $app:$app /home/yunohost.app/$app/media -chmod 664 /home/yunohost.app/$app/media +mkdir -p $install_dir/run +chown $app:$app $install_dir/run +chmod 664 $install_dir/run #================================================= # APP INITIAL CONFIGURATION @@ -76,7 +68,7 @@ chmod 664 /home/yunohost.app/$app/media #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/motioneye.conf" --destination="/var/www/$app/motioneye.conf" +ynh_add_config --template="../conf/motioneye.conf" --destination="$install_dir/motioneye.conf" #================================================= diff --git a/scripts/restore b/scripts/restore index c4c4f60..521c371 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,6 +19,17 @@ 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 + #================================================= # RESTORE THE DATA DIRECTORY #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fdd4a8e..5f91923 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,6 +30,12 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" + + pushd $install_dir + python3 -m venv venv + venv/bin/pip install --upgrade pip + venv/bin/pip install source.tar.gz + popd fi chown -R $app:www-data "$install_dir" @@ -54,10 +60,10 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file" +ynh_add_config --template="../conf/motioneye.conf" --destination="$install_dir/motioneye.conf" -chmod 400 "$install_dir/some_config_file" -chown $app:$app "$install_dir/some_config_file" +chmod 600 "$install_dir/motioneye.conf" +chown $app:$app "$install_dir/motioneye.conf" #================================================= # START SYSTEMD SERVICE