1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osada_ynh.git synced 2024-09-03 19:46:30 +02:00

Merge pull request #6 from YunoHost-Apps/testing

Improved install and  upgrade
This commit is contained in:
anmol26s 2021-02-18 03:30:38 +05:30 committed by GitHub
commit e1a902dbb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 89 additions and 5 deletions

View file

@ -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..."

View file

@ -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
#=================================================