Merge pull request #651 from YunoHost/fix-missing-getopts

[fix] Loading only one helper file leads to errors because missing getopts
This commit is contained in:
Alexandre Aubin 2019-02-18 15:55:42 +01:00 committed by GitHub
commit 4ddfa6881f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 18 additions and 22 deletions

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/ldap"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/ssh"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/ynh/mysql"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/ssowat"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/data/home"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/ynh/firewall"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/ynh/certs"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/data/mail"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/xmpp"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/nginx"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/cron"

View file

@ -4,7 +4,7 @@
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers.d/filesystem
source /usr/share/yunohost/helpers
# Backup destination
backup_dir="${1}/conf/ynh"

View file

@ -2,7 +2,7 @@
set -e
. /usr/share/yunohost/helpers.d/utils
. /usr/share/yunohost/helpers
do_pre_regen() {
pending_dir=$1

View file

@ -2,7 +2,7 @@
set -e
. /usr/share/yunohost/helpers.d/utils
. /usr/share/yunohost/helpers
do_init_regen() {
if [[ $EUID -ne 0 ]]; then

View file

@ -2,6 +2,7 @@
set -e
MYSQL_PKG="mariadb-server-10.1"
. /usr/share/yunohost/helpers
do_pre_regen() {
pending_dir=$1
@ -15,7 +16,6 @@ do_post_regen() {
regen_conf_files=$1
if [ ! -f /etc/yunohost/mysql ]; then
. /usr/share/yunohost/helpers.d/string
# ensure that mysql is running
sudo systemctl -q is-active mysql.service \
@ -25,8 +25,6 @@ do_post_regen() {
mysql_password=$(ynh_string_random 10)
sudo mysqladmin -s -u root -pyunohost password "$mysql_password" || {
if [ $FORCE -eq 1 ]; then
. /usr/share/yunohost/helpers.d/package
echo "It seems that you have already configured MySQL." \
"YunoHost needs to have a root access to MySQL to runs its" \
"applications, and is going to reset the MySQL root password." \

View file

@ -1,13 +1,11 @@
#!/bin/bash
set -e
. /usr/share/yunohost/helpers
do_pre_regen() {
pending_dir=$1
# source ip helpers
. /usr/share/yunohost/helpers.d/ip
cd /usr/share/yunohost/templates/dnsmasq
# create directory for pending conf

View file

@ -1,6 +1,8 @@
backup_dir="$1/conf/ynh/mysql"
MYSQL_PKG="mariadb-server-10.1"
. /usr/share/yunohost/helpers
# ensure that mysql is running
service mysql status >/dev/null 2>&1 \
|| service mysql start
@ -11,13 +13,11 @@ service mysql status >/dev/null 2>&1 \
new_pwd=$(sudo cat "${backup_dir}/root_pwd" || sudo cat "${backup_dir}/mysql")
[ -z "$curr_pwd" ] && curr_pwd="yunohost"
[ -z "$new_pwd" ] && {
. /usr/share/yunohost/helpers.d/string
new_pwd=$(ynh_string_random 10)
}
# attempt to change it
sudo mysqladmin -s -u root -p"$curr_pwd" password "$new_pwd" || {
. /usr/share/yunohost/helpers.d/package
echo "It seems that you have already configured MySQL." \
"YunoHost needs to have a root access to MySQL to runs its" \