mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Also lint/reformat core bash hooks
This commit is contained in:
parent
6048d1b0b3
commit
5a7a719661
20 changed files with 819 additions and 833 deletions
|
@ -10,8 +10,7 @@ yunohost tools shell -c "from yunohost.regenconf import manually_modified_files;
|
||||||
|
|
||||||
ynh_backup --src_path="./manually_modified_files_list"
|
ynh_backup --src_path="./manually_modified_files_list"
|
||||||
|
|
||||||
for file in $(cat ./manually_modified_files_list)
|
for file in $(cat ./manually_modified_files_list); do
|
||||||
do
|
|
||||||
[[ -e $file ]] && ynh_backup --src_path="$file"
|
[[ -e $file ]] && ynh_backup --src_path="$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,7 @@ EOF
|
||||||
# If we subscribed to a dyndns domain, add the corresponding cron
|
# If we subscribed to a dyndns domain, add the corresponding cron
|
||||||
# - delay between 0 and 60 secs to spread the check over a 1 min window
|
# - delay between 0 and 60 secs to spread the check over a 1 min window
|
||||||
# - do not run the command if some process already has the lock, to avoid queuing hundreds of commands...
|
# - do not run the command if some process already has the lock, to avoid queuing hundreds of commands...
|
||||||
if ls -l /etc/yunohost/dyndns/K*.private 2>/dev/null
|
if ls -l /etc/yunohost/dyndns/K*.private 2>/dev/null; then
|
||||||
then
|
|
||||||
cat >$pending_dir/etc/cron.d/yunohost-dyndns <<EOF
|
cat >$pending_dir/etc/cron.d/yunohost-dyndns <<EOF
|
||||||
SHELL=/bin/bash
|
SHELL=/bin/bash
|
||||||
*/10 * * * * root : YunoHost DynDNS update; sleep \$((RANDOM\\%60)); test -e /var/run/moulinette_yunohost.lock || yunohost dyndns update >> /dev/null
|
*/10 * * * * root : YunoHost DynDNS update; sleep \$((RANDOM\\%60)); test -e /var/run/moulinette_yunohost.lock || yunohost dyndns update >> /dev/null
|
||||||
|
@ -144,8 +143,7 @@ EOF
|
||||||
|
|
||||||
cp yunoprompt.service ${pending_dir}/etc/systemd/system/yunoprompt.service
|
cp yunoprompt.service ${pending_dir}/etc/systemd/system/yunoprompt.service
|
||||||
|
|
||||||
if [[ "$(yunohost settings get 'security.experimental.enabled')" == "True" ]]
|
if [[ "$(yunohost settings get 'security.experimental.enabled')" == "True" ]]; then
|
||||||
then
|
|
||||||
cp proc-hidepid.service ${pending_dir}/etc/systemd/system/proc-hidepid.service
|
cp proc-hidepid.service ${pending_dir}/etc/systemd/system/proc-hidepid.service
|
||||||
else
|
else
|
||||||
touch ${pending_dir}/etc/systemd/system/proc-hidepid.service
|
touch ${pending_dir}/etc/systemd/system/proc-hidepid.service
|
||||||
|
@ -192,8 +190,7 @@ do_post_regen() {
|
||||||
setfacl -m g:all_users:--- /etc/yunohost
|
setfacl -m g:all_users:--- /etc/yunohost
|
||||||
setfacl -m g:all_users:--- /etc/ssowat
|
setfacl -m g:all_users:--- /etc/ssowat
|
||||||
|
|
||||||
for USER in $(yunohost user list --quiet --output-as json | jq -r '.users | .[] | .username')
|
for USER in $(yunohost user list --quiet --output-as json | jq -r '.users | .[] | .username'); do
|
||||||
do
|
|
||||||
[ ! -e "/home/$USER" ] || setfacl -m g:all_users:--- /home/$USER
|
[ ! -e "/home/$USER" ] || setfacl -m g:all_users:--- /home/$USER
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -214,17 +211,18 @@ do_post_regen() {
|
||||||
grep -q '^sftp.app:' /etc/group || groupadd sftp.app
|
grep -q '^sftp.app:' /etc/group || groupadd sftp.app
|
||||||
|
|
||||||
# Propagates changes in systemd service config overrides
|
# Propagates changes in systemd service config overrides
|
||||||
[[ ! "$regen_conf_files" =~ "ntp.service.d/ynh-override.conf" ]] || { systemctl daemon-reload; systemctl restart ntp; }
|
[[ ! "$regen_conf_files" =~ "ntp.service.d/ynh-override.conf" ]] || {
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart ntp
|
||||||
|
}
|
||||||
[[ ! "$regen_conf_files" =~ "nftables.service.d/ynh-override.conf" ]] || systemctl daemon-reload
|
[[ ! "$regen_conf_files" =~ "nftables.service.d/ynh-override.conf" ]] || systemctl daemon-reload
|
||||||
[[ ! "$regen_conf_files" =~ "login.conf.d/ynh-override.conf" ]] || systemctl daemon-reload
|
[[ ! "$regen_conf_files" =~ "login.conf.d/ynh-override.conf" ]] || systemctl daemon-reload
|
||||||
if [[ "$regen_conf_files" =~ "yunoprompt.service" ]]
|
if [[ "$regen_conf_files" =~ "yunoprompt.service" ]]; then
|
||||||
then
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
action=$([[ -e /etc/systemd/system/yunoprompt.service ]] && echo 'enable' || echo 'disable')
|
action=$([[ -e /etc/systemd/system/yunoprompt.service ]] && echo 'enable' || echo 'disable')
|
||||||
systemctl $action yunoprompt --quiet --now
|
systemctl $action yunoprompt --quiet --now
|
||||||
fi
|
fi
|
||||||
if [[ "$regen_conf_files" =~ "proc-hidepid.service" ]]
|
if [[ "$regen_conf_files" =~ "proc-hidepid.service" ]]; then
|
||||||
then
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
action=$([[ -e /etc/systemd/system/proc-hidepid.service ]] && echo 'enable' || echo 'disable')
|
action=$([[ -e /etc/systemd/system/proc-hidepid.service ]] && echo 'enable' || echo 'disable')
|
||||||
systemctl $action proc-hidepid --quiet --now
|
systemctl $action proc-hidepid --quiet --now
|
||||||
|
|
|
@ -110,8 +110,7 @@ do_post_regen() {
|
||||||
current_local_ca_domain=$(openssl x509 -in $ynh_ca -text | tr ',' '\n' | grep Issuer | awk '{print $4}')
|
current_local_ca_domain=$(openssl x509 -in $ynh_ca -text | tr ',' '\n' | grep Issuer | awk '{print $4}')
|
||||||
main_domain=$(cat /etc/yunohost/current_host)
|
main_domain=$(cat /etc/yunohost/current_host)
|
||||||
|
|
||||||
if [[ "$current_local_ca_domain" != "$main_domain" ]]
|
if [[ "$current_local_ca_domain" != "$main_domain" ]]; then
|
||||||
then
|
|
||||||
regen_local_ca $main_domain
|
regen_local_ca $main_domain
|
||||||
# Idk how useful this is, but this was in the previous python code (domain.main_domain())
|
# Idk how useful this is, but this was in the previous python code (domain.main_domain())
|
||||||
ln -sf /etc/yunohost/certs/$domain/crt.pem /etc/ssl/certs/yunohost_crt.pem
|
ln -sf /etc/yunohost/certs/$domain/crt.pem /etc/ssl/certs/yunohost_crt.pem
|
||||||
|
|
|
@ -62,8 +62,7 @@ EOF
|
||||||
# We don't use mkhomedir_helper because 'admin' may not be recognized
|
# We don't use mkhomedir_helper because 'admin' may not be recognized
|
||||||
# when this script is ran in a chroot (e.g. ISO install)
|
# when this script is ran in a chroot (e.g. ISO install)
|
||||||
# We also refer to admin as uid 1007 for the same reason
|
# We also refer to admin as uid 1007 for the same reason
|
||||||
if [ ! -d /home/admin ]
|
if [ ! -d /home/admin ]; then
|
||||||
then
|
|
||||||
cp -r /etc/skel /home/admin
|
cp -r /etc/skel /home/admin
|
||||||
chown -R 1007:1007 /home/admin
|
chown -R 1007:1007 /home/admin
|
||||||
fi
|
fi
|
||||||
|
@ -97,8 +96,8 @@ do_pre_regen() {
|
||||||
|
|
||||||
# Define if we need to migrate from hdb to mdb
|
# Define if we need to migrate from hdb to mdb
|
||||||
curr_backend=$(grep '^database' /etc/ldap/slapd.conf 2>/dev/null | awk '{print $2}')
|
curr_backend=$(grep '^database' /etc/ldap/slapd.conf 2>/dev/null | awk '{print $2}')
|
||||||
if [ -e /etc/ldap/slapd.conf ] && [ -n "$curr_backend" ] && \
|
if [ -e /etc/ldap/slapd.conf ] && [ -n "$curr_backend" ] \
|
||||||
[ $curr_backend != 'mdb' ]; then
|
&& [ $curr_backend != 'mdb' ]; then
|
||||||
backup_dir="/var/backups/dc=yunohost,dc=org-${curr_backend}-$(date +%s)"
|
backup_dir="/var/backups/dc=yunohost,dc=org-${curr_backend}-$(date +%s)"
|
||||||
mkdir -p "$backup_dir"
|
mkdir -p "$backup_dir"
|
||||||
slapcat -b dc=yunohost,dc=org -l "${backup_dir}/dc=yunohost-dc=org.ldif"
|
slapcat -b dc=yunohost,dc=org -l "${backup_dir}/dc=yunohost-dc=org.ldif"
|
||||||
|
@ -138,16 +137,14 @@ do_post_regen() {
|
||||||
chown -R openldap:openldap /etc/ldap/slapd.d/
|
chown -R openldap:openldap /etc/ldap/slapd.d/
|
||||||
|
|
||||||
# If we changed the systemd ynh-override conf
|
# If we changed the systemd ynh-override conf
|
||||||
if echo "$regen_conf_files" | sed 's/,/\n/g' | grep -q "^/etc/systemd/system/slapd.service.d/ynh-override.conf$"
|
if echo "$regen_conf_files" | sed 's/,/\n/g' | grep -q "^/etc/systemd/system/slapd.service.d/ynh-override.conf$"; then
|
||||||
then
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl restart slapd
|
systemctl restart slapd
|
||||||
sleep 3
|
sleep 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For some reason, old setups don't have the admins group defined...
|
# For some reason, old setups don't have the admins group defined...
|
||||||
if ! slapcat | grep -q 'cn=admins,ou=groups,dc=yunohost,dc=org'
|
if ! slapcat | grep -q 'cn=admins,ou=groups,dc=yunohost,dc=org'; then
|
||||||
then
|
|
||||||
slapadd -F /etc/ldap/slapd.d -b dc=yunohost,dc=org <<< \
|
slapadd -F /etc/ldap/slapd.d -b dc=yunohost,dc=org <<< \
|
||||||
"dn: cn=admins,ou=groups,dc=yunohost,dc=org
|
"dn: cn=admins,ou=groups,dc=yunohost,dc=org
|
||||||
cn: admins
|
cn: admins
|
||||||
|
@ -192,8 +189,7 @@ objectClass: top"
|
||||||
# wait a maximum time of 5 minutes
|
# wait a maximum time of 5 minutes
|
||||||
# yes, force-reload behave like a restart
|
# yes, force-reload behave like a restart
|
||||||
number_of_wait=0
|
number_of_wait=0
|
||||||
while ! su admin -c '' && ((number_of_wait < 60))
|
while ! su admin -c '' && ((number_of_wait < 60)); do
|
||||||
do
|
|
||||||
sleep 5
|
sleep 5
|
||||||
((number_of_wait += 1))
|
((number_of_wait += 1))
|
||||||
done
|
done
|
||||||
|
|
|
@ -8,8 +8,7 @@ do_pre_regen() {
|
||||||
mkdir --parents "${pending_dir}/etc/apt/preferences.d"
|
mkdir --parents "${pending_dir}/etc/apt/preferences.d"
|
||||||
|
|
||||||
packages_to_refuse_from_sury="php php-fpm php-mysql php-xml php-zip php-mbstring php-ldap php-gd php-curl php-bz2 php-json php-sqlite3 php-intl openssl libssl1.1 libssl-dev"
|
packages_to_refuse_from_sury="php php-fpm php-mysql php-xml php-zip php-mbstring php-ldap php-gd php-curl php-bz2 php-json php-sqlite3 php-intl openssl libssl1.1 libssl-dev"
|
||||||
for package in $packages_to_refuse_from_sury
|
for package in $packages_to_refuse_from_sury; do
|
||||||
do
|
|
||||||
echo "
|
echo "
|
||||||
Package: $package
|
Package: $package
|
||||||
Pin: origin \"packages.sury.org\"
|
Pin: origin \"packages.sury.org\"
|
||||||
|
|
|
@ -32,8 +32,14 @@ do_init_regen() {
|
||||||
cp "redirect_to_admin.conf" $nginx_conf_dir/default.d/
|
cp "redirect_to_admin.conf" $nginx_conf_dir/default.d/
|
||||||
|
|
||||||
# Restart nginx if conf looks good, otherwise display error and exit unhappy
|
# Restart nginx if conf looks good, otherwise display error and exit unhappy
|
||||||
nginx -t 2>/dev/null || { nginx -t; exit 1; }
|
nginx -t 2>/dev/null || {
|
||||||
systemctl restart nginx || { journalctl --no-pager --lines=10 -u nginx >&2; exit 1; }
|
nginx -t
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
systemctl restart nginx || {
|
||||||
|
journalctl --no-pager --lines=10 -u nginx >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -51,8 +57,7 @@ do_pre_regen() {
|
||||||
cp plain/* "$nginx_conf_dir"
|
cp plain/* "$nginx_conf_dir"
|
||||||
# remove the panel overlay if this is specified in settings
|
# remove the panel overlay if this is specified in settings
|
||||||
panel_overlay=$(yunohost settings get 'ssowat.panel_overlay.enabled')
|
panel_overlay=$(yunohost settings get 'ssowat.panel_overlay.enabled')
|
||||||
if [ "$panel_overlay" == "false" ] || [ "$panel_overlay" == "False" ]
|
if [ "$panel_overlay" == "false" ] || [ "$panel_overlay" == "False" ]; then
|
||||||
then
|
|
||||||
echo "#" >"${nginx_conf_dir}/yunohost_panel.conf.inc"
|
echo "#" >"${nginx_conf_dir}/yunohost_panel.conf.inc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -88,8 +93,7 @@ do_pre_regen() {
|
||||||
done
|
done
|
||||||
|
|
||||||
export webadmin_allowlist_enabled=$(yunohost settings get security.webadmin.allowlist.enabled)
|
export webadmin_allowlist_enabled=$(yunohost settings get security.webadmin.allowlist.enabled)
|
||||||
if [ "$webadmin_allowlist_enabled" == "True" ]
|
if [ "$webadmin_allowlist_enabled" == "True" ]; then
|
||||||
then
|
|
||||||
export webadmin_allowlist=$(yunohost settings get security.webadmin.allowlist)
|
export webadmin_allowlist=$(yunohost settings get security.webadmin.allowlist)
|
||||||
fi
|
fi
|
||||||
ynh_render_template "yunohost_admin.conf.inc" "${nginx_conf_dir}/yunohost_admin.conf.inc"
|
ynh_render_template "yunohost_admin.conf.inc" "${nginx_conf_dir}/yunohost_admin.conf.inc"
|
||||||
|
@ -133,11 +137,9 @@ do_post_regen() {
|
||||||
# Get rid of legacy lets encrypt snippets
|
# Get rid of legacy lets encrypt snippets
|
||||||
for domain in $YNH_DOMAINS; do
|
for domain in $YNH_DOMAINS; do
|
||||||
# If the legacy letsencrypt / acme-challenge domain-specific snippet is still there
|
# If the legacy letsencrypt / acme-challenge domain-specific snippet is still there
|
||||||
if [ -e /etc/nginx/conf.d/${domain}.d/000-acmechallenge.conf ]
|
if [ -e /etc/nginx/conf.d/${domain}.d/000-acmechallenge.conf ]; then
|
||||||
then
|
|
||||||
# And if we're effectively including the new domain-independant snippet now
|
# And if we're effectively including the new domain-independant snippet now
|
||||||
if grep -q "include /etc/nginx/conf.d/acme-challenge.conf.inc;" /etc/nginx/conf.d/${domain}.conf
|
if grep -q "include /etc/nginx/conf.d/acme-challenge.conf.inc;" /etc/nginx/conf.d/${domain}.conf; then
|
||||||
then
|
|
||||||
# Delete the old domain-specific snippet
|
# Delete the old domain-specific snippet
|
||||||
rm /etc/nginx/conf.d/${domain}.d/000-acmechallenge.conf
|
rm /etc/nginx/conf.d/${domain}.d/000-acmechallenge.conf
|
||||||
fi
|
fi
|
||||||
|
@ -145,8 +147,14 @@ do_post_regen() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# Reload nginx if conf looks good, otherwise display error and exit unhappy
|
# Reload nginx if conf looks good, otherwise display error and exit unhappy
|
||||||
nginx -t 2>/dev/null || { nginx -t; exit 1; }
|
nginx -t 2>/dev/null || {
|
||||||
pgrep nginx && systemctl reload nginx || { journalctl --no-pager --lines=10 -u nginx >&2; exit 1; }
|
nginx -t
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
pgrep nginx && systemctl reload nginx || {
|
||||||
|
journalctl --no-pager --lines=10 -u nginx >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do_$1_regen ${@:2}
|
do_$1_regen ${@:2}
|
||||||
|
|
|
@ -29,8 +29,7 @@ do_pre_regen() {
|
||||||
export relay_port=""
|
export relay_port=""
|
||||||
export relay_user=""
|
export relay_user=""
|
||||||
export relay_host="$(yunohost settings get 'smtp.relay.host')"
|
export relay_host="$(yunohost settings get 'smtp.relay.host')"
|
||||||
if [ -n "${relay_host}" ]
|
if [ -n "${relay_host}" ]; then
|
||||||
then
|
|
||||||
relay_port="$(yunohost settings get 'smtp.relay.port')"
|
relay_port="$(yunohost settings get 'smtp.relay.port')"
|
||||||
relay_user="$(yunohost settings get 'smtp.relay.user')"
|
relay_user="$(yunohost settings get 'smtp.relay.user')"
|
||||||
relay_password="$(yunohost settings get 'smtp.relay.password')"
|
relay_password="$(yunohost settings get 'smtp.relay.password')"
|
||||||
|
@ -69,8 +68,7 @@ do_pre_regen() {
|
||||||
do_post_regen() {
|
do_post_regen() {
|
||||||
regen_conf_files=$1
|
regen_conf_files=$1
|
||||||
|
|
||||||
if [ -e /etc/postfix/sasl_passwd ]
|
if [ -e /etc/postfix/sasl_passwd ]; then
|
||||||
then
|
|
||||||
chmod 750 /etc/postfix/sasl_passwd*
|
chmod 750 /etc/postfix/sasl_passwd*
|
||||||
chown postfix:root /etc/postfix/sasl_passwd*
|
chown postfix:root /etc/postfix/sasl_passwd*
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -14,8 +14,7 @@ do_pre_regen() {
|
||||||
do_post_regen() {
|
do_post_regen() {
|
||||||
regen_conf_files=$1
|
regen_conf_files=$1
|
||||||
|
|
||||||
if [[ ! -d /var/lib/mysql/mysql ]]
|
if [[ ! -d /var/lib/mysql/mysql ]]; then
|
||||||
then
|
|
||||||
# dpkg-reconfigure will initialize mysql (if it ain't already)
|
# dpkg-reconfigure will initialize mysql (if it ain't already)
|
||||||
# It enabled auth_socket for root, so no need to define any root password...
|
# It enabled auth_socket for root, so no need to define any root password...
|
||||||
# c.f. : cat /var/lib/dpkg/info/mariadb-server-10.3.postinst | grep install_db -C3
|
# c.f. : cat /var/lib/dpkg/info/mariadb-server-10.3.postinst | grep install_db -C3
|
||||||
|
@ -37,16 +36,14 @@ do_post_regen() {
|
||||||
# This is a trick to check if we're able to use mysql without password
|
# This is a trick to check if we're able to use mysql without password
|
||||||
# Expect instances installed in stretch to already have unix_socket
|
# Expect instances installed in stretch to already have unix_socket
|
||||||
#configured, but not old instances from the jessie/wheezy era
|
#configured, but not old instances from the jessie/wheezy era
|
||||||
if ! echo "" | mysql 2>/dev/null
|
if ! echo "" | mysql 2>/dev/null; then
|
||||||
then
|
|
||||||
password="$(cat /etc/yunohost/mysql)"
|
password="$(cat /etc/yunohost/mysql)"
|
||||||
# Enable plugin unix_socket for root on localhost
|
# Enable plugin unix_socket for root on localhost
|
||||||
mysql -u root -p"$password" <<<"GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED WITH unix_socket WITH GRANT OPTION;"
|
mysql -u root -p"$password" <<<"GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED WITH unix_socket WITH GRANT OPTION;"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If now we're able to login without password, drop the mysql password
|
# If now we're able to login without password, drop the mysql password
|
||||||
if echo "" | mysql 2>/dev/null
|
if echo "" | mysql 2>/dev/null; then
|
||||||
then
|
|
||||||
rm /etc/yunohost/mysql
|
rm /etc/yunohost/mysql
|
||||||
else
|
else
|
||||||
echo "Can't connect to mysql using unix_socket auth ... something went wrong while trying to get rid of mysql password !?" >&2
|
echo "Can't connect to mysql using unix_socket auth ... something went wrong while trying to get rid of mysql password !?" >&2
|
||||||
|
@ -56,8 +53,7 @@ do_post_regen() {
|
||||||
# mysql is supposed to be an alias to mariadb... but in some weird case is not
|
# mysql is supposed to be an alias to mariadb... but in some weird case is not
|
||||||
# c.f. https://forum.yunohost.org/t/mysql-ne-fonctionne-pas/11661
|
# c.f. https://forum.yunohost.org/t/mysql-ne-fonctionne-pas/11661
|
||||||
# Playing with enable/disable allows to recreate the proper symlinks.
|
# Playing with enable/disable allows to recreate the proper symlinks.
|
||||||
if [ ! -e /etc/systemd/system/mysql.service ]
|
if [ ! -e /etc/systemd/system/mysql.service ]; then
|
||||||
then
|
|
||||||
systemctl stop mysql -q
|
systemctl stop mysql -q
|
||||||
systemctl disable mysql -q
|
systemctl disable mysql -q
|
||||||
systemctl disable mariadb -q
|
systemctl disable mariadb -q
|
||||||
|
|
|
@ -5,8 +5,7 @@ set -e
|
||||||
_generate_config() {
|
_generate_config() {
|
||||||
echo "domains:"
|
echo "domains:"
|
||||||
echo " - yunohost.local"
|
echo " - yunohost.local"
|
||||||
for domain in $YNH_DOMAINS
|
for domain in $YNH_DOMAINS; do
|
||||||
do
|
|
||||||
# Only keep .local domains (don't keep
|
# Only keep .local domains (don't keep
|
||||||
[[ "$domain" =~ [^.]+\.[^.]+\.local$ ]] && echo "Subdomain $domain cannot be handled by Bonjour/Zeroconf/mDNS" >&2
|
[[ "$domain" =~ [^.]+\.[^.]+\.local$ ]] && echo "Subdomain $domain cannot be handled by Bonjour/Zeroconf/mDNS" >&2
|
||||||
[[ "$domain" =~ ^[^.]+\.local$ ]] || continue
|
[[ "$domain" =~ ^[^.]+\.local$ ]] || continue
|
||||||
|
@ -39,14 +38,12 @@ do_post_regen() {
|
||||||
chown mdns:mdns /etc/yunohost/mdns.yml
|
chown mdns:mdns /etc/yunohost/mdns.yml
|
||||||
|
|
||||||
# If we changed the systemd ynh-override conf
|
# If we changed the systemd ynh-override conf
|
||||||
if echo "$regen_conf_files" | sed 's/,/\n/g' | grep -q "^/etc/systemd/system/yunomdns.service$"
|
if echo "$regen_conf_files" | sed 's/,/\n/g' | grep -q "^/etc/systemd/system/yunomdns.service$"; then
|
||||||
then
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Legacy stuff to enable the new yunomdns service on legacy systems
|
# Legacy stuff to enable the new yunomdns service on legacy systems
|
||||||
if [[ -e /etc/avahi/avahi-daemon.conf ]] && grep -q 'yunohost' /etc/avahi/avahi-daemon.conf
|
if [[ -e /etc/avahi/avahi-daemon.conf ]] && grep -q 'yunohost' /etc/avahi/avahi-daemon.conf; then
|
||||||
then
|
|
||||||
systemctl enable yunomdns
|
systemctl enable yunomdns
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,8 @@ do_post_regen() {
|
||||||
|
|
||||||
# Fuck it, those domain/search entries from dhclient are usually annoying
|
# Fuck it, those domain/search entries from dhclient are usually annoying
|
||||||
# lying shit from the ISP trying to MiTM
|
# lying shit from the ISP trying to MiTM
|
||||||
if grep -q -E "^ *(domain|search)" /run/resolvconf/resolv.conf
|
if grep -q -E "^ *(domain|search)" /run/resolvconf/resolv.conf; then
|
||||||
then
|
if grep -q -E "^ *(domain|search)" /run/resolvconf/interface/*.dhclient 2>/dev/null; then
|
||||||
if grep -q -E "^ *(domain|search)" /run/resolvconf/interface/*.dhclient 2>/dev/null
|
|
||||||
then
|
|
||||||
sed -E "s/^(domain|search)/#\1/g" -i /run/resolvconf/interface/*.dhclient
|
sed -E "s/^(domain|search)/#\1/g" -i /run/resolvconf/interface/*.dhclient
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -71,8 +69,7 @@ do_post_regen() {
|
||||||
[[ -n "$regen_conf_files" ]] || return
|
[[ -n "$regen_conf_files" ]] || return
|
||||||
|
|
||||||
# Remove / disable services likely to conflict with dnsmasq
|
# Remove / disable services likely to conflict with dnsmasq
|
||||||
for SERVICE in systemd-resolved bind9
|
for SERVICE in systemd-resolved bind9; do
|
||||||
do
|
|
||||||
systemctl is-enabled $SERVICE &>/dev/null && systemctl disable $SERVICE 2>/dev/null
|
systemctl is-enabled $SERVICE &>/dev/null && systemctl disable $SERVICE 2>/dev/null
|
||||||
systemctl is-active $SERVICE &>/dev/null && systemctl stop $SERVICE
|
systemctl is-active $SERVICE &>/dev/null && systemctl stop $SERVICE
|
||||||
done
|
done
|
||||||
|
|
|
@ -14,11 +14,11 @@ die() {
|
||||||
|
|
||||||
# Restore saved configuration and database
|
# Restore saved configuration and database
|
||||||
[[ $state -ge 1 ]] \
|
[[ $state -ge 1 ]] \
|
||||||
&& (rm -rf /etc/ldap/slapd.d &&
|
&& (rm -rf /etc/ldap/slapd.d \
|
||||||
mv "${TMPDIR}/slapd.d" /etc/ldap/slapd.d)
|
&& mv "${TMPDIR}/slapd.d" /etc/ldap/slapd.d)
|
||||||
[[ $state -ge 2 ]] \
|
[[ $state -ge 2 ]] \
|
||||||
&& (rm -rf /var/lib/ldap &&
|
&& (rm -rf /var/lib/ldap \
|
||||||
mv "${TMPDIR}/ldap" /var/lib/ldap)
|
&& mv "${TMPDIR}/ldap" /var/lib/ldap)
|
||||||
chown -R openldap: /etc/ldap/slapd.d /var/lib/ldap
|
chown -R openldap: /etc/ldap/slapd.d /var/lib/ldap
|
||||||
|
|
||||||
systemctl start slapd
|
systemctl start slapd
|
||||||
|
|
|
@ -5,8 +5,7 @@ ynh_abort_if_errors
|
||||||
YNH_CWD="${YNH_BACKUP_DIR%/}/conf/manually_modified_files"
|
YNH_CWD="${YNH_BACKUP_DIR%/}/conf/manually_modified_files"
|
||||||
cd "$YNH_CWD"
|
cd "$YNH_CWD"
|
||||||
|
|
||||||
for file in $(cat ./manually_modified_files_list)
|
for file in $(cat ./manually_modified_files_list); do
|
||||||
do
|
|
||||||
ynh_restore_file --origin_path="$file" --not_mandatory
|
ynh_restore_file --origin_path="$file" --not_mandatory
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue