diff --git a/README.md b/README.md index 2a4c78d..7d029ee 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* -Version: 2020-11-26 +Version: 21.02.11 ### Interesting links diff --git a/conf/app.src b/conf/app.src index 7a1ae2d..e7fe09c 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://codeberg.org/zot/zap/archive/fe8db82c6e31e7ce7255a086814d285d3dcbe5b8.tar.gz -SOURCE_SUM=59d081cd8525a55ed18fa0cec37181821b6ee305a1df8aa23bfcff48b85b8f7f +SOURCE_URL=https://codeberg.org/zot/zap/archive/4a62de088cc36027d6b1cb99c01eee12a18c3ce9.tar.gz +SOURCE_SUM=03ae2135792ce58823a44c216a75b14c0539fd9732d4520814db472405bdd6b0 SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR= SOURCE_FILENAME= diff --git a/conf/app_addons.src b/conf/app_addons.src index d18f4b2..1e8346c 100644 --- a/conf/app_addons.src +++ b/conf/app_addons.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://codeberg.org/zot/zap-addons/archive/6a888a5ba705fd9e2231322db9bb402abdc577f5.tar.gz -SOURCE_SUM=75d95927eeb2ab92d152796654d4e5fb35dcdea9d1d39613812034b74c481568 +SOURCE_URL=https://codeberg.org/zot/zap-addons/archive/756560a51d600b52447c810929cea88d717e95fc.tar.gz +SOURCE_SUM=99af572f730293687129f67d22a6576cc93751d808b5371af110fb836ef345d1 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR= diff --git a/manifest.json b/manifest.json index 230ba93..f400a71 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "A fediverse server." }, - "version": "2020-11-26~ynh1", + "version": "21.02.11~ynh1", "url": "https://zotlabs.com/zap/", "license": "MIT", "maintainer": { diff --git a/scripts/install b/scripts/install index f8d53fa..55f5df3 100755 --- a/scripts/install +++ b/scripts/install @@ -79,16 +79,43 @@ ynh_script_progression --message="Setting up Zap source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +git clone clone https://codeberg.org/zot/zap.git "$final_path" + # 2 - Zap Addons # Make addon Directory and unpack the addons to this directory ynh_script_progression --message="Create addon directory inside root folder..." -mkdir $final_path/addon ynh_script_progression --message="Setting up Zap addons source files..." -ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" +pushd "$final_path" + mkdir -p extend/addon/zaddons + mkdir addon + git clone https://codeberg.org/zot/zap-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 diff --git a/scripts/upgrade b/scripts/upgrade index 48046aa..ce7fbf1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,16 +58,11 @@ ynh_abort_if_errors #================================================= ynh_print_info "Upgrading source files..." # 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" +# ynh_secure_remove "$final_path" # If final_path doesn't exist, create it if [ -z "$final_path" ]; then @@ -75,17 +70,6 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -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" - #================================================= # STANDARD UPGRADE STEPS @@ -95,16 +79,69 @@ ynh_setup_source --dest_dir="$final_path" 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" +# 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" +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 #=================================================