diff --git a/scripts/install b/scripts/install index 69ba8fa..2d7bb74 100755 --- a/scripts/install +++ b/scripts/install @@ -90,9 +90,34 @@ ynh_script_progression --message="Setting up Osada addons source files..." # ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" pushd "$final_path" - util/add_addon_repo https://codeberg.org/zot/osada-addons.git zaddons + mkdir -p extend/addon/zaddons + mkdir addon + git clone https://codeberg.org/zot/osada-addons.git $final_path/extend/addon/zaddons + filelist=(`ls extend/addon/zaddons`) + cd addon + for a in "${filelist[@]}" ; do + base=`basename $a` + if [ $base = '.git' ]; then + #echo 'ignoring git' + continue; + fi + if [ ! -d ../extend/addon/zaddons/$base ]; then + #echo $a 'not a directory' + continue; + fi + if [ -x $base ]; then + #echo $base 'file exists' + continue; + fi + + echo linking $base + + ln -s ../extend/addon/zaddons/$base $base + done + popd + # 3 - Some extra folders ynh_script_progression --message="Creating smarty3 folder for personal data..." diff --git a/scripts/upgrade b/scripts/upgrade index f4e22b0..9d03e17 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,10 +88,69 @@ ynh_setup_source --dest_dir="$final_path" # chmod -R 777 $final_path/store # mkdir $final_path/addon # ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" -pushd "$final_path" - util/udall -popd -chmod -R 777 $final_path/store $final_path/cache + +if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then + pushd "$final_path" + git pull + cd extend/addon/zaddons + git pull + cd ../../.. + filelist=(`ls extend/addon/zaddons`) + cd addon + for a in "${filelist[@]}" ; do + base=`basename $a` + if [ $base = '.git' ]; then + #echo 'ignoring git' + continue; + fi + if [ ! -d ../extend/addon/zaddons/$base ]; then + #echo $a 'not a directory' + continue; + fi + if [ -x $base ]; then + #echo $base 'file exists' + continue; + fi + + echo linking $base + + ln -s ../extend/addon/zaddons/$base $base + done + for x in `ls` ; do + if [ -L "$x" ] && ! [ -e "$x" ]; then + echo "removing dead symlink $x" ; + rm -- "$x"; + fi; + done + popd + chmod -R 777 $final_path/store +else + + # Create a temporary directory + tmpdir="$(ynh_smart_mktemp 6000)" + # Backup the config file in the temp dir + cp -a "$final_path/.htconfig.php" "$tmpdir/.htconfig.php" + cp -a "$final_path/store" "$tmpdir/store" + cp -a "$final_path/php.log" "$tmpdir/php.log" + cp -a "$final_path/cache" "$tmpdir/cache" + + # Remove the app directory securely + ynh_secure_remove "$final_path" + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" + + cp -a "$tmpdir/cache" "${final_path}" + cp -a "$tmpdir/store" "${final_path}" + cp -a "$tmpdir/.htconfig.php" "${final_path}" + cp -a "$tmpdir/php.log" "${final_path}" + ynh_secure_remove --file="$tmpdir" + chmod -R 777 $final_path/store + mkdir $final_path/addon + ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" + +fi + #================================================= # NGINX CONFIGURATION #=================================================