mirror of
https://github.com/YunoHost-Apps/xwiki_ynh.git
synced 2024-09-03 20:36:11 +02:00
Fix shell check
This commit is contained in:
parent
40e081cecd
commit
dbfd8a66af
7 changed files with 52 additions and 52 deletions
|
@ -24,7 +24,7 @@ else
|
|||
install_on_root=false
|
||||
path2=${path/#\//}/ # path=/xwiki -> xwiki/
|
||||
path3=${path/#\//} # path=/xwiki -> xwiki
|
||||
web_inf_path="$install_dir"/webapps$path/WEB-INF
|
||||
web_inf_path="$install_dir/webapps$path/WEB-INF"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -34,18 +34,18 @@ fi
|
|||
enable_super_admin() {
|
||||
super_admin_pwd=$(ynh_string_random)
|
||||
super_admin_config="xwiki.superadminpassword=$super_admin_pwd"
|
||||
ynh_add_config --template=xwiki.cfg --destination=/etc/$app/xwiki_conf.cfg
|
||||
ln -f /etc/$app/xwiki_conf.cfg "$web_inf_path"/xwiki.cfg
|
||||
chmod 400 /etc/$app/xwiki_conf.cfg
|
||||
chown "$app:$app" /etc/$app/xwiki_conf.cfg
|
||||
ynh_add_config --template=xwiki.cfg --destination=/etc/"$app"/xwiki_conf.cfg
|
||||
ln -f /etc/"$app"/xwiki_conf.cfg "$web_inf_path"/xwiki.cfg
|
||||
chmod 400 /etc/"$app"/xwiki_conf.cfg
|
||||
chown "$app:$app" /etc/"$app"/xwiki_conf.cfg
|
||||
}
|
||||
|
||||
disable_super_admin() {
|
||||
super_admin_config='#'
|
||||
ynh_add_config --template=xwiki.cfg --destination=/etc/$app/xwiki_conf.cfg
|
||||
ln -f /etc/$app/xwiki_conf.cfg "$web_inf_path"/xwiki.cfg
|
||||
chmod 400 /etc/$app/xwiki_conf.cfg
|
||||
chown "$app:$app" /etc/$app/xwiki_conf.cfg
|
||||
ynh_add_config --template=xwiki.cfg --destination=/etc/"$app"/xwiki_conf.cfg
|
||||
ln -f /etc/"$app"/xwiki_conf.cfg "$web_inf_path"/xwiki.cfg
|
||||
chmod 400 /etc/"$app"/xwiki_conf.cfg
|
||||
chown "$app:$app" /etc/"$app"/xwiki_conf.cfg
|
||||
}
|
||||
|
||||
install_exension() {
|
||||
|
@ -66,12 +66,12 @@ install_exension() {
|
|||
local status_raw
|
||||
local state_request
|
||||
|
||||
chmod 700 $temp_dir
|
||||
chown root:root $temp_dir
|
||||
chmod 700 "$temp_dir"
|
||||
chown root:root "$temp_dir"
|
||||
|
||||
ynh_add_config --template=install_extensions.xml --destination=$temp_dir/install_extensions.xml
|
||||
ynh_add_config --template=install_extensions.xml --destination="$temp_dir"/install_extensions.xml
|
||||
status_raw=$($curl -i --user "superadmin:$super_admin_pwd" -X PUT -H 'Content-Type: text/xml' "http://127.0.0.1:$port/${path2}rest/jobs?jobType=install&async=true" --upload-file $temp_dir/install_extensions.xml)
|
||||
state_request=$(echo $status_raw | $xq -x '//jobStatus/ns2:state')
|
||||
state_request=$(echo "$status_raw" | $xq -x '//jobStatus/ns2:state')
|
||||
|
||||
while true; do
|
||||
sleep 5
|
||||
|
@ -152,14 +152,14 @@ install_source() {
|
|||
elif [ "$path" == /root ]; then
|
||||
ynh_die --message='Path "/root" not supported'
|
||||
elif [ "$path" != /xwiki ]; then
|
||||
mv "$install_dir"/webapps/xwiki "$install_dir"/webapps$path
|
||||
mv "$install_dir"/webapps/xwiki "$install_dir/webapps$path"
|
||||
fi
|
||||
}
|
||||
|
||||
add_config() {
|
||||
ynh_add_config --template=hibernate.cfg.xml --destination=/etc/$app/hibernate.cfg.xml
|
||||
ynh_add_config --template=xwiki.cfg --destination=/etc/$app/xwiki_conf.cfg
|
||||
ynh_add_config --template=xwiki.properties --destination=/etc/$app/xwiki_conf.properties
|
||||
ynh_add_config --template=hibernate.cfg.xml --destination=/etc/"$app"/hibernate.cfg.xml
|
||||
ynh_add_config --template=xwiki.cfg --destination=/etc/"$app"/xwiki_conf.cfg
|
||||
ynh_add_config --template=xwiki.properties --destination=/etc/"$app"/xwiki_conf.properties
|
||||
|
||||
# Note that using /etc/xwiki/xwiki.cfg or /etc/xwiki/xwiki.properties is hard coded on the application
|
||||
# And using this break multi instance feature so we must use an other path
|
||||
|
@ -172,16 +172,16 @@ set_permissions() {
|
|||
chmod -R u+rwX,o-rwx "$install_dir"
|
||||
chown -R "$app:$app" "$install_dir"
|
||||
|
||||
chmod -R u=rwX,g=rX,o= /etc/$app
|
||||
chown -R "$app:$app" /etc/$app
|
||||
chmod -R u=rwX,g=rX,o= /etc/"$app"
|
||||
chown -R "$app:$app" /etc/"$app"
|
||||
|
||||
chown "$app:$app" -R /var/log/$app
|
||||
chmod u=rwX,g=rX,o= -R /var/log/$app
|
||||
chown "$app:$app" -R /var/log/"$app"
|
||||
chmod u=rwX,g=rX,o= -R /var/log/"$app"
|
||||
|
||||
find $data_dir \( \! -perm -o= \
|
||||
-o \! -user $app \
|
||||
-o \! -group $app \) \
|
||||
-exec chown $app:$app {} \; \
|
||||
find "$data_dir" \( \! -perm -o= \
|
||||
-o \! -user "$app" \
|
||||
-o \! -group "$app" \) \
|
||||
-exec chown "$app:$app" {} \; \
|
||||
-exec chmod u=rwX,g=rX,o= {} \;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
if systemctl is-active $app --quiet; then
|
||||
if systemctl is-active "$app" --quiet; then
|
||||
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'"
|
||||
fi
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=stop
|
||||
ynh_systemd_action --service_name="$app" --action=stop
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
@ -27,15 +27,15 @@ ynh_change_url_nginx_config
|
|||
|
||||
ynh_script_progression --message="Updating xwiki configuration..." --weight=1
|
||||
|
||||
if [ $new_path != $old_path ]; then
|
||||
if $install_on_root; then
|
||||
mv "$install_dir"/webapps$old_path "$install_dir"/webapps/root
|
||||
if [ "$new_path" != "$old_path" ]; then
|
||||
if "$install_on_root"; then
|
||||
mv "$install_dir/webapps$old_path" "$install_dir"/webapps/root
|
||||
elif [ "$path" == /root ]; then
|
||||
ynh_die --message='Path "/root" not supported'
|
||||
elif [ $old_path == / ]; then
|
||||
mv "$install_dir"/webapps/root "$install_dir"/webapps$new_path
|
||||
mv "$install_dir"/webapps/root "$install_dir/webapps$new_path"
|
||||
else
|
||||
mv "$install_dir"/webapps$old_path "$install_dir"/webapps$new_path
|
||||
mv "$install_dir/webapps$old_path" "$install_dir/webapps$new_path"
|
||||
fi
|
||||
fi
|
||||
add_config
|
||||
|
@ -48,7 +48,7 @@ set_permissions
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
wait_xwiki_started
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -13,15 +13,15 @@ source /usr/share/yunohost/helpers
|
|||
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
||||
#=================================================
|
||||
|
||||
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')"
|
||||
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"/*
|
||||
fi
|
||||
|
||||
mkdir -p /var/log/"$app"
|
||||
mkdir -p /etc/$app
|
||||
mkdir -p /etc/"$app"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -61,9 +61,9 @@ ynh_use_logrotate --logfile="/var/log/$app"
|
|||
enable_super_admin
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
|
||||
if [ $install_standard_flavor -eq 1 ]; then
|
||||
if [ "$install_standard_flavor" -eq 1 ]; then
|
||||
ynh_script_progression --message='Installing flavor...'
|
||||
wait_for_flavor_install
|
||||
fi
|
||||
|
@ -72,7 +72,7 @@ ynh_script_progression --message='Installing LDAP extension...' --weight=1
|
|||
install_exension 'org.xwiki.contrib.ldap:ldap-authenticator' "$ldap_version"
|
||||
|
||||
# Disable super admin
|
||||
ynh_systemd_action --service_name=$app --action=stop
|
||||
ynh_systemd_action --service_name="$app" --action=stop
|
||||
disable_super_admin
|
||||
|
||||
#=================================================
|
||||
|
@ -82,7 +82,7 @@ disable_super_admin
|
|||
#=================================================
|
||||
|
||||
ynh_script_progression --message='Starting a systemd service...' --weight=1
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
wait_xwiki_started
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -17,10 +17,10 @@ source /usr/share/yunohost/helpers
|
|||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
if ynh_exec_warn_less yunohost service status "$app" >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
yunohost service remove $app
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
ynh_secure_remove --file="/etc/$app"
|
||||
|
|
|
@ -22,7 +22,7 @@ ynh_restore
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the database..." --weight=1
|
||||
|
||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
|
@ -32,8 +32,8 @@ ynh_script_progression --message="Restoring system configurations related to $ap
|
|||
mkdir -p /var/log/"$app"
|
||||
set_permissions
|
||||
|
||||
systemctl enable $app.service --quiet
|
||||
yunohost service add $app --description=XWiki --log="/var/log/$app/$app.log"
|
||||
systemctl enable "$app".service --quiet
|
||||
yunohost service add "$app" --description=XWiki --log="/var/log/$app/$app.log"
|
||||
|
||||
ynh_use_logrotate --logfile="/var/log/$app"
|
||||
|
||||
|
@ -44,7 +44,7 @@ ynh_use_logrotate --logfile="/var/log/$app"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
wait_xwiki_started
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
upgrade_type="$(ynh_check_app_version_changed)"
|
||||
|
||||
if ynh_compare_current_package_version --comparison=le --version='14.10.8~ynh1'; then
|
||||
ynh_die --mesage='Upgrade from this version is not supported. Please backup and restore manually the data after a clean new install'
|
||||
|
@ -20,7 +20,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message='Stopping a systemd service..' --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name="$app" --action=stop --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
||||
|
@ -63,9 +63,9 @@ set_permissions
|
|||
enable_super_admin
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
|
||||
if [ $install_standard_flavor -eq 1 ]; then
|
||||
if [ "$install_standard_flavor" -eq 1 ]; then
|
||||
ynh_script_progression --message='Upgrading flavor...'
|
||||
wait_for_flavor_install
|
||||
fi
|
||||
|
@ -74,7 +74,7 @@ ynh_script_progression --message='Upgrading LDAP extension...' --weight=1
|
|||
install_exension 'org.xwiki.contrib.ldap:ldap-authenticator' "$ldap_version"
|
||||
|
||||
# Disable super admin
|
||||
ynh_systemd_action --service_name=$app --action=stop
|
||||
ynh_systemd_action --service_name="$app" --action=stop
|
||||
disable_super_admin
|
||||
|
||||
#=================================================
|
||||
|
@ -84,7 +84,7 @@ disable_super_admin
|
|||
#=================================================
|
||||
|
||||
ynh_script_progression --message='Starting a systemd service...' --weight=1
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
||||
wait_xwiki_started
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue