1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/streams_ynh.git synced 2024-09-03 20:26:20 +02:00

upgrade script was using git pull

This commit is contained in:
dragondaddy 2023-08-02 11:48:10 +02:00
parent 98a36bd854
commit ee47d6b1b6
2 changed files with 22 additions and 61 deletions

View file

@ -82,12 +82,10 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
# 1 - Streams
ynh_script_progression --message="Setting up Streams 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_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path"
# 2 - Composer
ynh_script_progression --message="Pulling in external libraries with Composer..."
@ -95,6 +93,7 @@ ynh_install_composer
# 3 - Streams Addons
# Download, check integrity, uncompress and patch the addons from app_addons.src
ynh_script_progression --message="Setting up Streams addons source files..."
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
# 4 - Some extra folders

View file

@ -9,6 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# LOAD SETTINGS
#=================================================
@ -81,68 +87,24 @@ ynh_system_user_create --username=$app --home_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"
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then
pushd "$final_path"
git pull --quiet
ynh_install_composer
cd extend/addon/zaddons
git pull --quiet
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 775 $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"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# 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 775 $final_path/store
mkdir $final_path/addon
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
# Composer update
ynh_script_progression --message="Pulling in external libraries with Composer..."
ynh_install_composer
ynh_script_progression --message="Setting up Streams addons source files..."
# Download, check integrity, uncompress and patch the addons from app_addons.src
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
fi
chmod 750 "$final_path"
@ -202,7 +164,7 @@ ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies_main
if [ $database -eq 2 ]; then
if [ $database == "postgresql" ]; then
ynh_install_app_dependencies $pkg_dependencies_psql
fi