1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minio_ynh.git synced 2024-09-03 19:46:18 +02:00
This commit is contained in:
Limezy 2023-01-29 16:07:58 +07:00
parent 7c4b21792b
commit 1528f50a40

View file

@ -128,6 +128,19 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="A High Performance, Kubernetes Native Object Storage" --log="/var/log/$app/$app.log" yunohost service add $app --description="A High Performance, Kubernetes Native Object Storage" --log="/var/log/$app/$app.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
if ynh_compare_current_package_version --comparison lt --version 2022.12.12~ynh1
then
ynh_script_progression --message="Moving old Filesystem to secure MinIO start"
old = "OLD"
mv "$datadir" "$datadir$old"
mkdir "$datadir"
fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
@ -159,7 +172,7 @@ ynh_script_progression --message="Ensuring downward compatibility..."
if ynh_compare_current_package_version --comparison lt --version 2022.12.12~ynh1 if ynh_compare_current_package_version --comparison lt --version 2022.12.12~ynh1
then then
ynh_script_progression --message="Migration from Filesystem to Single-Node Single-Drive mode" ynh_script_progression --message="Migration from Filesystem to Single-Node Single-Drive mode"
pushd $datadir pushd $datadir$old
for d in * ; do for d in * ; do
if [ "$d" == "*" ] if [ "$d" == "*" ]
then then
@ -169,7 +182,7 @@ then
mv "$d" "DATA_$d" mv "$d" "DATA_$d"
pushd $mc_path pushd $mc_path
ynh_exec_warn_less sudo -u $app ./mc mb minio/"$d" ynh_exec_warn_less sudo -u $app ./mc mb minio/"$d"
ynh_exec_warn_less sudo -u $app ./mc mirror --preserve "$datadir/DATA_$d" minio/"$d" ynh_exec_warn_less sudo -u $app ./mc mirror --preserve "$datadir$old/DATA_$d" minio/"$d"
# This is a hack, but it will make outline_ynh users' lifes much easier ! # This is a hack, but it will make outline_ynh users' lifes much easier !
if [ "$d" == "outlinestorage" ] if [ "$d" == "outlinestorage" ]
then then
@ -182,6 +195,7 @@ then
fi fi
done done
popd popd
ynh_secure_remove --file="$datadir$old"
else else
ynh_script_progression --message="No migration required" ynh_script_progression --message="No migration required"
fi fi