Fix shell check error

This commit is contained in:
Josué Tille 2024-04-26 23:35:14 +02:00
parent b0580c33e6
commit 3392d5f0c0
No known key found for this signature in database
GPG key ID: 5F259226AD51F2F5
6 changed files with 41 additions and 44 deletions

View file

@ -6,7 +6,7 @@ readonly time_zone="$(cat /etc/timezone)"
readonly python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" readonly python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
# Create special path with / at the end # Create special path with / at the end
if [[ $path == '/' ]] if [[ "$path" == '/' ]]
then then
readonly path2="$path" readonly path2="$path"
else else
@ -33,20 +33,20 @@ install_pkg_conf() {
install_dependance() { install_dependance() {
# Clean venv is it was on python3 with old version in case major upgrade of debian # Clean venv is it was on python3 with old version in case major upgrade of debian
if [ ! -e $install_dir/venv/bin/python3 ] || [ ! -e $install_dir/venv/lib/python$python_version ]; then if [ ! -e "$install_dir"/venv/bin/python3 ] || [ ! -e "$install_dir/venv/lib/python$python_version" ]; then
ynh_secure_remove --file=$install_dir/venv/bin ynh_secure_remove --file="$install_dir"/venv/bin
ynh_secure_remove --file=$install_dir/venv/lib ynh_secure_remove --file="$install_dir"/venv/lib
ynh_secure_remove --file=$install_dir/venv/lib64 ynh_secure_remove --file="$install_dir"/venv/lib64
ynh_secure_remove --file=$install_dir/venv/include ynh_secure_remove --file="$install_dir"/venv/include
ynh_secure_remove --file=$install_dir/venv/share ynh_secure_remove --file="$install_dir"/venv/share
ynh_secure_remove --file=$install_dir/venv/pyvenv.cfg ynh_secure_remove --file="$install_dir"/venv/pyvenv.cfg
fi fi
# Create venv if it don't exist # Create venv if it don't exist
test -e $install_dir/venv/bin/python3 || python3 -m venv $install_dir/venv test -e "$install_dir"/venv/bin/python3 || python3 -m venv "$install_dir"/venv
py_dependancy="django==4.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.2.* pylibmc captcha==0.5.* markupsafe==2.0.1 jinja2 sqlalchemy==2.0.18 psd-tools django-pylibmc django_simple_captcha==0.6.* djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.15.1 lxml python-ldap==3.4.3" py_dependancy="django==4.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.2.* pylibmc captcha==0.5.* markupsafe==2.0.1 jinja2 sqlalchemy==2.0.18 psd-tools django-pylibmc django_simple_captcha==0.6.* djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.15.1 lxml python-ldap==3.4.3"
$install_dir/venv/bin/pip3 install --upgrade --timeout=3600 $py_dependancy "$install_dir"/venv/bin/pip3 install --upgrade --timeout=3600 $py_dependancy
# Create symbolic link to venv package on seahub # Create symbolic link to venv package on seahub
ls "$install_dir/venv/lib/python$python_version/site-packages" | while read -r f; do ls "$install_dir/venv/lib/python$python_version/site-packages" | while read -r f; do
@ -69,10 +69,10 @@ set_permission() {
setfacl -m user:www-data:rX "$install_dir" setfacl -m user:www-data:rX "$install_dir"
setfacl -m user:www-data:rX "$install_dir/seafile-server-$seafile_version" setfacl -m user:www-data:rX "$install_dir/seafile-server-$seafile_version"
# At install time theses directory are not available # At install time theses directory are not available
test -e $install_dir/seafile-server-$seafile_version/seahub && setfacl -m user:www-data:rX $install_dir/seafile-server-$seafile_version/seahub test -e "$install_dir/seafile-server-$seafile_version/seahub" && setfacl -m user:www-data:rX "$install_dir/seafile-server-$seafile_version/seahub"
test -e $install_dir/seafile-server-$seafile_version/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-$seafile_version/seahub/media test -e "$install_dir/seafile-server-$seafile_version/seahub/media" && setfacl -R -m user:www-data:rX "$install_dir/seafile-server-$seafile_version/seahub/media"
test -e $install_dir/seahub-data && setfacl -m user:www-data:rX $data_dir test -e "$install_dir"/seahub-data && setfacl -m user:www-data:rX "$data_dir"
test -e $install_dir/seahub-data && setfacl -R -m user:www-data:rX $data_dir/seahub-data test -e "$install_dir"/seahub-data && setfacl -R -m user:www-data:rX "$data_dir"/seahub-data
find "$data_dir" \( \! -perm -o= \ find "$data_dir" \( \! -perm -o= \
-o \! -user "$app" \ -o \! -user "$app" \

View file

@ -11,14 +11,14 @@ source ./_common.sh
# Source YunoHost helpers # Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
seafile_version=$(ynh_app_upstream_version) seafile_version="$(ynh_app_upstream_version)"
# Create special path with / at the end # Create special path with / at the end
if [[ $path == '/' ]] if [[ $path == '/' ]]
then then
path2=$path path2="$path"
else else
path2=$path"/" path2="$path/"
fi fi
#================================================= #=================================================
@ -46,14 +46,14 @@ pkill -f seahub || true
ynh_script_progression --message="Updating seafile configuration..." ynh_script_progression --message="Updating seafile configuration..."
# Update Seafile Config # Update Seafile Config
ynh_add_config --template=seahub_settings.py --destination=$install_dir/conf/seahub_settings.py ynh_add_config --template=seahub_settings.py --destination="$install_dir"/conf/seahub_settings.py
ynh_add_config --template=ccnet.conf --destination=$install_dir/conf/ccnet.conf ynh_add_config --template=ccnet.conf --destination="$install_dir"/conf/ccnet.conf
ynh_add_config --template=gunicorn.conf.py --destination=$install_dir/conf/gunicorn.conf.py ynh_add_config --template=gunicorn.conf.py --destination="$install_dir"/conf/gunicorn.conf.py
ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.conf ynh_add_config --template=seafdav.conf --destination="$install_dir"/conf/seafdav.conf
# Update permissions # Update permissions
ynh_permission_url --permission=file_server --url=$domain/seafhttp ynh_permission_url --permission=file_server --url="$domain"/seafhttp
ynh_permission_url --permission=webdav --url=$domain/seafdav ynh_permission_url --permission=webdav --url="$domain"/seafdav
# Clean url in config in DB # Clean url in config in DB
clean_url_in_db_config clean_url_in_db_config

View file

@ -103,7 +103,7 @@ ln -s "$data_dir"/seahub-data "$install_dir"/seahub-data
ln -s /var/log/"$app" "$install_dir"/logs ln -s /var/log/"$app" "$install_dir"/logs
# Fix local warning # Fix local warning
ynh_replace_string --match_string=en_US.UTF-8 --replace_string=${LANG:-'en_US.UTF-8'} --target_file="$install_dir/seafile-server-$seafile_version/seahub.sh" ynh_replace_string --match_string=en_US.UTF-8 --replace_string="${LANG:-'en_US.UTF-8'}" --target_file="$install_dir/seafile-server-$seafile_version/seahub.sh"
# Add Seafile Server to startup # Add Seafile Server to startup
ynh_script_progression --message="Configuring a systemd service..." ynh_script_progression --message="Configuring a systemd service..."

View file

@ -11,7 +11,7 @@ source ./_common.sh
# Source YunoHost helpers # Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
seafile_version=$(ynh_app_upstream_version) seafile_version="$(ynh_app_upstream_version)"
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -34,8 +34,8 @@ if [ "$YNH_APP_PURGE" -eq 1 ]; then
ynh_secure_remove --file=/var/log/"$app" ynh_secure_remove --file=/var/log/"$app"
fi fi
ynh_script_progression --message="Removing code..." ynh_script_progression --message="Removing code..."
ynh_secure_remove --file=/var/www/$app ynh_secure_remove --file=/var/www/"$app"
ynh_secure_remove --file=/opt/yunohost/$app ynh_secure_remove --file=/opt/yunohost/"$app"
# Remove databases # Remove databases
ynh_script_progression --message="Removing databases..." ynh_script_progression --message="Removing databases..."

View file

@ -11,13 +11,10 @@ source ../settings/scripts/_common.sh
# Source YunoHost helpers # Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
seafile_version=$(ynh_app_upstream_version) seafile_version="$(ynh_app_upstream_version)"
ynh_script_progression --message="Loading settings..." ynh_script_progression --message="Loading settings..."
# Retrieve arguments
seafile_version=$(ynh_app_upstream_version)
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================

View file

@ -11,8 +11,8 @@ source ./_common.sh
# Source YunoHost helpers # Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
seafile_version=$(ynh_app_upstream_version) seafile_version="$(ynh_app_upstream_version)"
installed_version=${YNH_APP_CURRENT_VERSION/~ynh*/} installed_version="${YNH_APP_CURRENT_VERSION/~ynh*/}"
ensure_vars_set ensure_vars_set
@ -47,7 +47,7 @@ fi
# Set missing settings # Set missing settings
if [ -z "${seahub_secret_key:-}" ]; then if [ -z "${seahub_secret_key:-}" ]; then
seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' "$install_dir"/conf/seahub_settings.py | cut -d'"' -f2) seahub_secret_key="$(grep -P 'SECRET_KEY\s*=\s*".+"' "$install_dir"/conf/seahub_settings.py | cut -d'"' -f2)"
ynh_app_setting_set --app="$app" --key=seahub_secret_key --value="$seahub_secret_key" ynh_app_setting_set --app="$app" --key=seahub_secret_key --value="$seahub_secret_key"
fi fi
@ -113,7 +113,7 @@ ynh_script_progression --message="Configuring application..."
set_permission set_permission
# do the upgrade ( the ";&" syntax mean when it go in the first case which is true it do all the next case) # do the upgrade ( the ";&" syntax mean when it go in the first case which is true it do all the next case)
case $installed_version in case "$installed_version" in
"4."* ) "4."* )
# Update seafile by script # Update seafile by script
ynh_die "Upgrade form the version 4.x was removed. Upgrade from this version won't be supported any more." ynh_die "Upgrade form the version 4.x was removed. Upgrade from this version won't be supported any more."
@ -168,11 +168,11 @@ sudo -u "$app" bash "$install_dir/seafile-server-$seafile_version/upgrade/minor-
clean_url_in_db_config clean_url_in_db_config
# Update seafile config files # Update seafile config files
ynh_add_jinja_config --template=seahub_settings.py --destination=$install_dir/conf/seahub_settings.py ynh_add_jinja_config --template=seahub_settings.py --destination="$install_dir"/conf/seahub_settings.py
ynh_add_config --template=seafile.conf --destination=$install_dir/conf/seafile.conf ynh_add_config --template=seafile.conf --destination="$install_dir"/conf/seafile.conf
ynh_add_config --template=ccnet.conf --destination=$install_dir/conf/ccnet.conf ynh_add_config --template=ccnet.conf --destination="$install_dir"/conf/ccnet.conf
ynh_add_config --template=gunicorn.conf.py --destination=$install_dir/conf/gunicorn.conf.py ynh_add_config --template=gunicorn.conf.py --destination="$install_dir"/conf/gunicorn.conf.py
ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.conf ynh_add_config --template=seafdav.conf --destination="$install_dir"/conf/seafdav.conf
ynh_add_config --template=seafevents.conf --destination="$install_dir"/conf/seafevents.conf ynh_add_config --template=seafevents.conf --destination="$install_dir"/conf/seafevents.conf
# Fix local warning # Fix local warning
@ -223,10 +223,10 @@ sleep 2
# remove old version files # remove old version files
ynh_script_progression --message="Cleaning system and updating settings..." ynh_script_progression --message="Cleaning system and updating settings..."
ls "$install_dir" | grep "seafile-server-" | grep -E -v "(${seafile_version//./\\.})|(latest)" | \ for f in "$install_dir"/seafile-server-*;do
while read -r f if [[ ! "$f" =~ ${seafile_version//./\\.}|latest ]]; then
do ynh_secure_remove --file="$f"
ynh_secure_remove --file="$install_dir/$f" fi
done done
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression --message="Upgrade of $app completed" --last