1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shaarli_ynh.git synced 2024-09-03 20:26:10 +02:00
This commit is contained in:
ericgaspar 2020-12-01 12:03:07 +01:00
parent 206f5173ac
commit 733cfdc207
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 28 additions and 39 deletions

View file

@ -133,14 +133,11 @@ ynh_add_config --template="../conf/config.json.php" --destination="$final_path/d
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# set proper permissions # set proper permissions
ynh_script_progression --message="Set permissions..." ynh_script_progression --message="Securing files and directories..."
find $final_path -type f | xargs chmod 644
find $final_path -type d | xargs chmod 755
# Set right permissions for curl install
ynh_script_progression --message="Set rights..."
chown -R $app: $final_path chown -R $app: $final_path
chmod -R g+rX $final_path
chmod -R g+rwX $final_path/{cache/,data/,pagecache/,tmp/}
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN

View file

@ -69,9 +69,11 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
chmod -R g+rX $final_path
chmod -R g+rwX $final_path/{cache/,data/,pagecache/,tmp/}
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION

View file

@ -72,33 +72,26 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Create a temporary directory # Create a temporary directory
tmpdir="$(ynh_smart_mktemp 600)" tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir # Backup the config file in the temp dir
cp -a "$final_path/data" "$tmpdir/" cp -a "$final_path/data" "$tmpdir/data"
# Backup the theme file in the temp dir cp -a "$final_path/tpl" "$tmpdir/tpl"
cp -a "$final_path/tpl" "$tmpdir/"
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove "$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source --dest_dir="$final_path"
cp -a "$tmpdir/data" "${final_path}/"
cp -a "$tmpdir/tpl" "${final_path}/" cp -a "$tmpdir/data" "$final_path/"
ynh_secure_remove "$tmpdir" cp -a "$tmpdir/tpl" "$final_path/"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -143,20 +136,17 @@ then
ynh_secure_remove "$final_path/data/log.txt" ynh_secure_remove "$final_path/data/log.txt"
touch "$final_path/data/log.txt" touch "$final_path/data/log.txt"
fi fi
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# set proper permissions ynh_script_progression --message="Securing files and directories..."
ynh_script_progression --message="Set permissions..."
find $final_path -type f | xargs chmod 644
find $final_path -type d | xargs chmod 755
# Set right permissions for curl install
ynh_script_progression --message="Set rights..."
chown -R $app: $final_path chown -R $app: $final_path
chmod -R g+rX $final_path
chmod -R g+rwX $final_path/{cache/,data/,pagecache/,tmp/}
#================================================= #=================================================
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN