server: remove odd backticks

This commit is contained in:
Ludovic Poujol 2024-07-10 12:03:02 +02:00 committed by Ludovic Poujol
parent b956bc89a5
commit f469a265ae
17 changed files with 45 additions and 45 deletions

View file

@ -24,7 +24,7 @@ test -d "${archive_jail_path}" && error "${jail_name}: archive already exists" 2
if [ "${FORCE}" != "1" ]; then
answer=""
while :; do
printf "> Are you sure you want to archive jail \`%s'? [Y,n,?] " "${jail_name}"
printf "> Are you sure you want to archive jail '%s'? [Y,n,?] " "${jail_name}"
read -r answer
case $answer in
[Yy]|"" )
@ -51,4 +51,4 @@ mv "${jail_path}" "${archive_jail_path}"
[ -e "/etc/systemd/nspawn/${jail_name}.nspawn" ] && rm "/etc/systemd/nspawn/${jail_name}.nspawn"
[ -e "/var/lib/machines/${jail_name}" ] && unlink "/var/lib/machines/${jail_name}"
notice "Archive jail \`${jail_name}' : OK"
notice "Archive jail '${jail_name}' : OK"

10
server/lib/bkctld-check-setup Executable file → Normal file
View file

@ -19,11 +19,11 @@ output=""
findmnt -O rw --mountpoint "${BACKUP_PARTITION}" > /dev/null
if [ "$?" -ne 0 ]; then
nb_crit=$((nb_crit + 1))
output="${output}CRITICAL - Backup disk \`/backup' is not mounted (or read-only) !\n"
output="${output}CRITICAL - Backup disk '/backup' is not mounted (or read-only) !\n"
return=2
else
nb_ok=$((nb_ok + 1))
output="${output}OK - Backup disk \`/backup' is mounted and writable.\n"
output="${output}OK - Backup disk '/backup' is mounted and writable.\n"
fi
# Check if the firewall file is sourced
@ -38,14 +38,14 @@ if [ -n "${FIREWALL_RULES}" ] \
if [ -n "${minifirewall_version}" ] && dpkg --compare-versions "${minifirewall_version}" ge "22.03"; then
# Minifirewall 22.03+ includes files automatically
nb_ok=$((nb_ok + 1))
output="${output}OK - Firewall file \`${FIREWALL_RULES}' is present.\n"
output="${output}OK - Firewall file '${FIREWALL_RULES}' is present.\n"
else
if grep -qE "^(\.|source) ${FIREWALL_RULES}" "${minifirewall_config}"; then
nb_ok=$((nb_ok + 1))
output="${output}OK - Firewall file \`${FIREWALL_RULES}' is sourced by \`${minifirewall_config}'.\n"
output="${output}OK - Firewall file '${FIREWALL_RULES}' is sourced by '${minifirewall_config}'.\n"
else
nb_warn=$((nb_warn + 1))
output="${output}WARNING - Firewall file \`${FIREWALL_RULES}' doesn't seem to be sourced by \`${minifirewall_config}'\n"
output="${output}WARNING - Firewall file '${FIREWALL_RULES}' doesn't seem to be sourced by '${minifirewall_config}'\n"
[ "${return}" -le 1 ] && return=1
fi
fi

4
server/lib/bkctld-convert-v2 Executable file → Normal file
View file

@ -17,9 +17,9 @@ test -d "${jail_path}" || error "${jail_name}: jail not found" 2
test $(get_jail_version "${jail_name}") -ne 1 && error "${jail_name}: This command only applies to jails in v1 format (currently $(get_jail_version "${jail_name}"))" 3
notice "Converting jail \`${jail_name}\`"
notice "Converting jail '${jail_name}'"
convert_jail_chroot_to_v2 "${jail_name}"
setup_jail_chroot "${jail_name}"
notice "Converted jail \`${jail_name}\` : OK"
notice "Converted jail '${jail_name}' : OK"

6
server/lib/bkctld-firewall Executable file → Normal file
View file

@ -18,7 +18,7 @@ iptables_input_accept() {
jail_name="${1}"
port="${2}"
ip="${3}"
debug "Accept \`${ip}:${port}' for jail \`${jail_name}'"
debug "Accept '${ip}:${port}' for jail '${jail_name}'"
echo "/sbin/iptables -A INPUT -p tcp --sport 1024: --dport ${port} -s ${ip} -j ACCEPT #${jail_name}"
}
@ -35,7 +35,7 @@ if [ -n "${FIREWALL_RULES}" ]; then
# Restart the firewall
[ -f /etc/init.d/minifirewall ] && /etc/init.d/minifirewall restart >/dev/null
fi
notice "Firewall updated for jail \`${jail_name}'"
notice "Firewall updated for jail '${jail_name}'"
else
notice "Skip jail \`${jail_name}' : FIREWALL_RULES variable is empty."
notice "Skip jail '${jail_name}' : FIREWALL_RULES variable is empty."
fi

8
server/lib/bkctld-inc Executable file → Normal file
View file

@ -60,7 +60,7 @@ for jail_name in ${jails_list}; do
# If inc directory is not present, we proceed with inc creation
if [ ! -d "${inc_path}" ]; then
info "Progress: jail ${jails_count} out of ${jails_total}"
notice "Create inc \`${inc_name}' for jail \`${jail_name}' : start"
notice "Create inc '${inc_name}' for jail '${jail_name}' : start"
if is_btrfs "${jail_path}"; then
create_inc_btrfs "${jail_name}" "${inc_name}"
@ -68,11 +68,11 @@ for jail_name in ${jails_list}; do
create_inc_ext4 "${jail_name}" "${inc_name}"
fi
notice "Create inc \`${inc_name}' for jail \`${jail_name}' : finish"
notice "Create inc '${inc_name}' for jail '${jail_name}' : finish"
else
warning "Skip inc \`${inc_name}' for jail \`${jail_name}' : it already exists."
warning "Skip inc '${inc_name}' for jail '${jail_name}' : it already exists."
fi
else
notice "Skip jail \`${jail_name}' : incs policy is missing"
notice "Skip jail '${jail_name}' : incs policy is missing"
fi
done

4
server/lib/bkctld-inc-lock Executable file → Normal file
View file

@ -44,10 +44,10 @@ if [ -d ${target_path} ]; then
elif [ "${lock_status}" = "off" ]; then
unlock_target "${target_path}"
else
error "Unknown lock status \`${lock_status}'."
error "Unknown lock status '${lock_status}'."
exit 1
fi
else
error "\`${target_path}': no such file or directory."
error "'${target_path}': no such file or directory."
exit 1
fi

4
server/lib/bkctld-init Executable file → Normal file
View file

@ -14,7 +14,7 @@ fi
jail_path=$(jail_path "${jail_name}")
incs_path=$(incs_path "${jail_name}")
test -d "${jail_path}" && error "Skip jail \`${jail_name}' : it already exists"
test -d "${jail_path}" && error "Skip jail '${jail_name}' : it already exists"
# Create config, jails and incs directories
mkdir --parents "${CONFDIR}" "${JAILDIR}" "${INCDIR}"
@ -34,4 +34,4 @@ mkdir --parents "${incs_path}"
setup_jail_chroot "${jail_name}"
setup_jail_config "${jail_name}"
notice "Create jail \`${jail_name}' : OK"
notice "Create jail '${jail_name}' : OK"

4
server/lib/bkctld-ip Executable file → Normal file
View file

@ -43,9 +43,9 @@ else
if grep -q -E "^AllowUsers" "${jail_sshd_config}"; then
sed --follow-symlinks --in-place "s~^AllowUsers .*~${allow_users}~" "${jail_sshd_config}"
else
error "No \`AllowUsers' directive found in \`${jail_sshd_config}'"
error "No 'AllowUsers' directive found in '${jail_sshd_config}'"
fi
notice "Update IP whitelist with \`${ip}' for jail \`${jail_name}' : OK"
notice "Update IP whitelist with '${ip}' for jail '${jail_name}' : OK"
"${LIBDIR}/bkctld-reload" "${jail_name}"
"${LIBDIR}/bkctld-firewall" "${jail_name}"
fi

4
server/lib/bkctld-key Executable file → Normal file
View file

@ -25,8 +25,8 @@ if [ -z "${keyfile}" ]; then
cat "${jail_rootfs_path}/${AUTHORIZED_KEYS}"
fi
else
test -r "${keyfile}" || error "SSH key \`${keyfile}' for jail \`${jail_name}' is missing or is not readable."
test -r "${keyfile}" || error "SSH key '${keyfile}' for jail '${jail_name}' is missing or is not readable."
cat "${keyfile}" > "${jail_rootfs_path}/${AUTHORIZED_KEYS}"
chmod 600 "${jail_rootfs_path}/${AUTHORIZED_KEYS}"
notice "Update SSH key \`${keyfile}' for jail \`${jail_name}' : OK"
notice "Update SSH key '${keyfile}' for jail '${jail_name}' : OK"
fi

2
server/lib/bkctld-port Executable file → Normal file
View file

@ -29,7 +29,7 @@ else
fi
sed --follow-symlinks --in-place "s/^Port .*/Port ${port}/" "${jail_sshd_config}"
notice "Update SSH port \`${port}' for jail \`${jail_name}' : OK"
notice "Update SSH port '${port}' for jail '${jail_name}' : OK"
"${LIBDIR}/bkctld-reload" "${jail_name}"
"${LIBDIR}/bkctld-firewall" "${jail_name}"

View file

@ -20,7 +20,7 @@ test -d "${jail_path}" || error "${jail_name}: jail not found" 2
pid=$(get_jail_sshd_pid "${jail_name}")
if kill -HUP "${pid}"; then
notice "Reload jail \`${jail_name}' : OK [${pid}]"
notice "Reload jail '${jail_name}' : OK [${pid}]"
else
error "Reload jail \`${jail_name}' : failed [${pid}]"
error "Reload jail '${jail_name}' : failed [${pid}]"
fi

View file

@ -28,7 +28,7 @@ fi
if [ "${FORCE}" != "1" ]; then
answer=""
while :; do
printf "> Are you sure you want to delete jail \`%s'? [Y,n,?] " "${jail_name}"
printf "> Are you sure you want to delete jail '%s'? [Y,n,?] " "${jail_name}"
read -r answer
case $answer in
[Yy]|"" )
@ -71,7 +71,7 @@ if [ -d "${incs_path}" ]; then
if [ "${inc_inode}" -eq 256 ]; then
${btrfs_bin} subvolume delete "${incs_path}/${inc}" | debug
else
warning "You need to purge \`${incs_path}/${inc}' manually"
warning "You need to purge '${incs_path}/${inc}' manually"
fi
done
rmdir --ignore-fail-on-non-empty "${incs_path}" | debug
@ -81,4 +81,4 @@ fi
[ -e "/var/lib/machines/${jail_name}" ] && unlink "/var/lib/machines/${jail_name}"
"${LIBDIR}/bkctld-firewall" "${jail_name}"
notice "Delete jail \`${jail_name}' : OK"
notice "Delete jail '${jail_name}' : OK"

View file

@ -16,7 +16,7 @@ if [ -z "${jail_name}" ] || [ -z "${new_jail_name}" ]; then
fi
jail_path=$(jail_path "${jail_name}")
jail_rootfs_path=$(jail_rootfs_path "${jail_name}")
#jail_rootfs_path=$(jail_rootfs_path "${jail_name}")
incs_path=$(incs_path "${jail_name}")
jail_config_dir=$(jail_config_dir "${jail_name}")
legacy_config_file="${CONFDIR}/${jail_name}"
@ -42,7 +42,7 @@ case "$?" in
;;
*)
unset jail_initial_status
error "Error evaluating jail \`${jail_name}' state. bkctld-is-on exited with \`$?'"
error "Error evaluating jail '${jail_name}' state. bkctld-is-on exited with '$?'"
;;
esac
@ -94,4 +94,4 @@ fi
test "${jail_initial_status}" = "on" && "${LIBDIR}/bkctld-start" "${new_jail_name}"
notice "Rename jail \`${jail_name}' to \`${new_jail_name}' : OK"
notice "Rename jail '${jail_name}' to '${new_jail_name}' : OK"

14
server/lib/bkctld-start Executable file → Normal file
View file

@ -21,8 +21,8 @@ test -d "${jail_path}" || error "${jail_name}: jail not found" 2
test $(get_jail_version "${jail_name}") -ne ${CURRENT_JAIL_VERSION} && error "${jail_name}: jail needs to be updated to version ${CURRENT_JAIL_VERSION} (currently $(get_jail_version "${jail_name}")) - Use bkctld convert-v2 <jail>" 3
# Start the jail
notice "Starting jail \`${jail_name}'"
systemctl start systemd-nspawn@${jail_name} || error "Failed to start nspawn container for jail \`${jail_name}'"
notice "Starting jail '${jail_name}'"
systemctl start systemd-nspawn@"${jail_name}" || error "Failed to start nspawn container for jail '${jail_name}'"
if systemctl is-active --quiet systemd-nspawn@${jail_name}; then
port=$("${LIBDIR}/bkctld-port" "${jail_name}")
@ -47,16 +47,16 @@ if systemctl is-active --quiet systemd-nspawn@${jail_name}; then
if [ "${success}" -eq 0 ]; then
notice "OK SSH : Started jail \`${jail_name}'"
notice "OK SSH : Started jail '${jail_name}'"
else
if systemctl is-active --quiet systemd-nspawn@${jail_name}; then
error "WARNING SSH : Jail is running, but failed to get response from sshd for jail \`${jail_name}' within 3 seconds"
if systemctl is-active --quiet systemd-nspawn@"${jail_name}"; then
error "WARNING SSH : Jail is running, but failed to get response from sshd for jail '${jail_name}' within 3 seconds"
else
error "Failed to to start \`${jail_name}' - Jail terminated. Check \`systemctl status systemd-nspawn@${jail_name}'"
error "Failed to to start '${jail_name}' - Jail terminated. Check 'systemctl status systemd-nspawn@${jail_name}'"
fi
fi
else
error "Failed to to start \`${jail_name}' - Jail terminated. Check \`systemctl status systemd-nspawn@${jail_name}'"
error "Failed to to start '${jail_name}' - Jail terminated. Check 'systemctl status systemd-nspawn@${jail_name}'"
fi

4
server/lib/bkctld-stop Executable file → Normal file
View file

@ -21,7 +21,7 @@ test $(get_jail_version "${jail_name}") -ne ${CURRENT_JAIL_VERSION} && error "${
"${LIBDIR}/bkctld-is-on" "${jail_name}" || exit 0
if systemctl stop systemd-nspawn@${jail_name}; then
notice "Stopped jail \`${jail_name}'"
notice "Stopped jail '${jail_name}'"
else
error "Stop jail \`${jail_name}' : failed"
error "Stop jail '${jail_name}' : failed"
fi

2
server/lib/bkctld-sync Executable file → Normal file
View file

@ -71,7 +71,7 @@ if "${LIBDIR}/bkctld-is-on" "${jail_name}"; then
ssh "${NODE}" "${LIBDIR}/bkctld-start ${jail_name}" | debug
;;
*)
error "Error evaluating jail \`${jail_name}' state. bkctld-is-on exited with \`$?'"
error "Error evaluating jail '${jail_name}' state. bkctld-is-on exited with '$?'"
;;
esac
else

4
server/lib/bkctld-update Executable file → Normal file
View file

@ -28,7 +28,7 @@ case "$?" in
;;
*)
unset jail_initial_status
error "Error evaluating jail \`${jail_name}' state. bkctld-is-on exited with \`$?'"
error "Error evaluating jail '${jail_name}' state. bkctld-is-on exited with '$?'"
;;
esac
@ -38,4 +38,4 @@ setup_jail_chroot "${jail_name}"
test "${jail_initial_status}" = "on" && "${LIBDIR}/bkctld-start" "${jail_name}"
notice "Update jail \`${jail_name}' : OK"
notice "Update jail '${jail_name}' : OK"