1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pgadmin_ynh.git synced 2024-09-03 19:56:38 +02:00

Fix shell check

This commit is contained in:
Josué Tille 2024-04-27 01:08:10 +02:00
parent 8f9aea80fb
commit 676f12fac8
No known key found for this signature in database
GPG key ID: 5F259226AD51F2F5
5 changed files with 43 additions and 43 deletions

View file

@ -13,47 +13,47 @@ postgresql_version="$(psql -V | cut -d' ' -f3 | cut -d. -f1)"
install_source() { install_source() {
# Clean venv is it was on python with an old version in case major upgrade of debian # Clean venv is it was on python with an old version in case major upgrade of debian
if [ ! -e $install_dir/venv/lib/python$python_version ] || ! grep -qF "$install_dir/venv/bin/python" "$install_dir"/venv/bin/pip; then if [ ! -e "$install_dir/venv/lib/python$python_version" ] || ! grep -qF "$install_dir/venv/bin/python" "$install_dir"/venv/bin/pip; 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
if uname -m | grep -q arm if uname -m | grep -q arm
then then
# Clean old file, sometime it could make some big issues if we don't do this !! # Clean old file, sometime it could make some big issues if we don't do this !!
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/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_setup_source --dest_dir $install_dir/venv/ --source_id "pgadmin_prebuilt_armv7_$(lsb_release --codename --short)" ynh_setup_source --dest_dir "$install_dir"/venv/ --source_id "pgadmin_prebuilt_armv7_$(lsb_release --codename --short)"
else else
# Install virtualenv if it don't exist # Install virtualenv 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
# Install pgadmin in virtualenv # Install pgadmin in virtualenv
pip=$install_dir/venv/bin/pip pip="$install_dir"/venv/bin/pip
$pip install --upgrade pip wheel $pip install --upgrade pip wheel
$pip install --upgrade -r "$YNH_APP_BASEDIR"/conf/requirement_$(lsb_release --codename --short).txt $pip install --upgrade -r "$YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt"
fi fi
# Apply patchs if needed # Apply patchs if needed
# Note that we put patch into scripts dir because /source are not stored and can't be used on restore # Note that we put patch into scripts dir because /source are not stored and can't be used on restore
if ! grep -F -q '# BEGIN Yunohost Patch' $install_dir/venv/lib/python$python_version/site-packages/pgadmin4/migrations/versions/fdc58d9bd449_.py; then if ! grep -F -q '# BEGIN Yunohost Patch' "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/migrations/versions/fdc58d9bd449_.py"; then
pushd $install_dir/venv/lib/python$python_version/site-packages/pgadmin4 pushd "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4"
patch -p1 < "$YNH_APP_BASEDIR"/scripts/patch/avoid_create_user_on_setup_db.patch patch -p1 < "$YNH_APP_BASEDIR"/scripts/patch/avoid_create_user_on_setup_db.patch
popd popd
fi fi
if ! grep -F -q '# BEGIN Yunohost Patch' $install_dir/venv/lib/python$python_version/site-packages/pgadmin4/pgadmin/__init__.py; then if ! grep -F -q '# BEGIN Yunohost Patch' "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/pgadmin/__init__.py"; then
pushd $install_dir/venv/lib/python$python_version/site-packages/pgadmin4 pushd "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4"
patch -p1 < "$YNH_APP_BASEDIR"/scripts/patch/fix_add_local_db.patch patch -p1 < "$YNH_APP_BASEDIR"/scripts/patch/fix_add_local_db.patch
popd popd
fi fi
if ! grep -F -q '# BEGIN Yunohost Patch' $install_dir/venv/lib/python$python_version/site-packages/pgadmin4/pgadmin/authenticate/webserver.py; then if ! grep -F -q '# BEGIN Yunohost Patch' "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/pgadmin/authenticate/webserver.py"; then
pushd $install_dir/venv/lib/python$python_version/site-packages/pgadmin4 pushd "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4"
patch -p1 < "$YNH_APP_BASEDIR"/scripts/patch/change_default_webserver_new_user_role_to_admin.patch patch -p1 < "$YNH_APP_BASEDIR"/scripts/patch/change_default_webserver_new_user_role_to_admin.patch
popd popd
fi fi
@ -61,16 +61,16 @@ install_source() {
set_permission() { set_permission() {
# Set permission # Set permission
chown $app:$app -R $install_dir chown "$app:$app" -R "$install_dir"
chmod u+rw,o= -R $install_dir chmod u+rw,o= -R "$install_dir"
chown $app:$app -R $data_dir chown "$app:$app" -R "$data_dir"
chmod u+rw,o= -R $data_dir chmod u+rw,o= -R "$data_dir"
chown $app:$app -R /var/log/$app chown "$app:$app" -R /var/log/"$app"
chmod u=rwX,g=rX,o= -R /var/log/$app chmod u=rwX,g=rX,o= -R /var/log/"$app"
# Criticals files # Criticals files
chown $app:root $data_dir/master_pwd chown "$app":root "$data_dir"/master_pwd
chmod u=r,g=,o= $data_dir/master_pwd chmod u=r,g=,o= "$data_dir"/master_pwd
chown $app:root $install_dir/postgres-reg.ini chown "$app":root "$install_dir"/postgres-reg.ini
chmod u=r,g=,o= $install_dir/postgres-reg.ini chmod u=r,g=,o= "$install_dir"/postgres-reg.ini
} }

View file

@ -20,13 +20,13 @@ ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER CREATEDB CREA
ynh_script_progression --message='Creating base directory...' ynh_script_progression --message='Creating base directory...'
if [ -n "$(ls -A $data_dir)" ]; then if [ -n "$(ls -A "$data_dir")" ]; then
old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')" old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')"
ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path" ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path"
mkdir -p $old_data_dir_path mkdir -p "$old_data_dir_path"
mv -t "$old_data_dir_path" "$data_dir"/* mv -t "$old_data_dir_path" "$data_dir"/*
fi fi
mkdir -p /var/log/$app mkdir -p /var/log/"$app"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE

View file

@ -17,8 +17,8 @@ ynh_script_progression --message="Removing system configurations related to $app
# Stop service # Stop service
ynh_systemd_action --service_name="$app.service" --action=stop ynh_systemd_action --service_name="$app.service" --action=stop
ynh_remove_systemd_config --service=$app ynh_remove_systemd_config --service="$app"
yunohost service remove $app yunohost service remove "$app"
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate

View file

@ -38,8 +38,8 @@ install_source
ynh_script_progression --message="Enable systemd services" --weight=2 ynh_script_progression --message="Enable systemd services" --weight=2
# systemctl daemon-reload # systemctl daemon-reload
systemctl enable $app.service --quiet systemctl enable "$app".service --quiet
yunohost service add $app --log "/var/log/$app/$app.log" --description 'PgAdmin application' yunohost service add "$app" --log "/var/log/$app/$app.log" --description 'PgAdmin application'
set_permission set_permission

View file

@ -49,8 +49,8 @@ if [ -d "$install_dir/data" ]; then
fi fi
ynh_secure_remove "$install_dir/data" ynh_secure_remove "$install_dir/data"
fi fi
if [ ! -e $data_dir/master_pwd ]; then if [ ! -e "$data_dir"/master_pwd ]; then
ynh_string_random --length=60 > $data_dir/master_pwd ynh_string_random --length=60 > "$data_dir"/master_pwd
fi fi
#================================================= #=================================================
@ -85,12 +85,12 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
ynh_add_nginx_config ynh_add_nginx_config
# Add systemd config # Add systemd config
ynh_add_systemd_config --service=$app --template=pgadmin.service ynh_add_systemd_config --service="$app" --template=pgadmin.service
yunohost service add $app --log "/var/log/$app/$app.log" --description 'PgAdmin application' yunohost service add "$app" --log "/var/log/$app/$app.log" --description 'PgAdmin application'
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --logfile=/var/log/$app --nonappend ynh_use_logrotate --logfile=/var/log/"$app" --nonappend
set_permission set_permission