remove not neaded echos

This commit is contained in:
2022-12-19 16:35:27 +01:00
parent 0c9ecf810d
commit 6fa1732981
+11 -21
View File
@@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
source "/variables.sh" source "/variables.sh"
############################################################################################################################## #####################################################################################################
# Funktionen # Funktionen
############################################################################################################################## #####################################################################################################
function print_container_info { function print_container_info {
sepurator sepurator
echo "* BorgServer powered by $BORG_VERSION" echo "* BorgServer powered by $BORG_VERSION"
@@ -55,7 +55,6 @@ function make_and_import_ssh_keys {
fi fi
echo "* IMPORT SSH KEYS" echo "* IMPORT SSH KEYS"
echo ""
FILES=$(ls -1 /sshkeys/clients) FILES=$(ls -1 /sshkeys/clients)
for key in $FILES; do for key in $FILES; do
@@ -76,31 +75,24 @@ function print_message {
} }
function generate_host_sshkey { function generate_host_sshkey {
local generated_keys="0"
echo "* GENERATE HOST SSH-KEYs"
# Generate SSH-Keys # Generate SSH-Keys
if [ ! -f "/sshkeys/host/ssh_host_rsa_key" ]; then if [ ! -f "/sshkeys/host/ssh_host_rsa_key" ]; then
sepurator
print_message "HOST SSH-KEY RSA not found, generating..." print_message "HOST SSH-KEY RSA not found, generating..."
ssh-keygen -t rsa -b 4096 -f "/sshkeys/host/ssh_host_rsa_key" -N "" ssh-keygen -t rsa -b 4096 -f "/sshkeys/host/ssh_host_rsa_key" -N ""
print_message "HOST SSH-KEY RSA Generated" print_message "HOST SSH-KEY RSA Generated"
generated_keys="1"
fi fi
if [ ! -f "/sshkeys/host/ssh_host_ecdsa_key" ]; then if [ ! -f "/sshkeys/host/ssh_host_ecdsa_key" ]; then
sepurator
print_message "HOST SSH-KEY ECDSA not found, generating..." print_message "HOST SSH-KEY ECDSA not found, generating..."
ssh-keygen -t ecdsa -b 521 -f "/sshkeys/host/ssh_host_ecdsa_key" -N "" ssh-keygen -t ecdsa -b 521 -f "/sshkeys/host/ssh_host_ecdsa_key" -N ""
print_message "HOST SSH-KEY ECDSA Generated" print_message "HOST SSH-KEY ECDSA Generated"
generated_keys="1"
fi fi
if [ ! -f "/sshkeys/host/ssh_host_ed25519_key" ]; then if [ ! -f "/sshkeys/host/ssh_host_ed25519_key" ]; then
sepurator
print_message "HOST SSH-KEY ED25519 not found, generating..." print_message "HOST SSH-KEY ED25519 not found, generating..."
ssh-keygen -t ed25519 -b 521 -f "/sshkeys/host/ssh_host_ed25519_key" -N "" ssh-keygen -t ed25519 -b 521 -f "/sshkeys/host/ssh_host_ed25519_key" -N ""
print_message "HOST SSH-KEY ED25519 Generated" print_message "HOST SSH-KEY ED25519 Generated"
generated_keys="1"
fi
if [ "$generated_keys" == "0" ]; then
echo ""
echo "- HOST SSH-KEYs already exist"
fi fi
chown -R "$USER":"$USER" "/sshkeys/host" chown -R "$USER":"$USER" "/sshkeys/host"
@@ -109,7 +101,6 @@ function generate_host_sshkey {
function maintenance_enable { function maintenance_enable {
if [ "$MAINTENANCE_ENABLE" != "false" ]; then if [ "$MAINTENANCE_ENABLE" != "false" ]; then
echo "* MAINTENANCE MODE - ENABLED" echo "* MAINTENANCE MODE - ENABLED"
echo ""
if [ -f "/crontab.txt" ]; then if [ -f "/crontab.txt" ]; then
crontab "/crontab.txt" crontab "/crontab.txt"
crond -i 2> /dev/null crond -i 2> /dev/null
@@ -137,7 +128,7 @@ function run_install_script {
echo "* RUNNING INSTALL SCRIPT" echo "* RUNNING INSTALL SCRIPT"
sepurator sepurator
sh "$RUN_INSTALL_SCRIPT" sh "$RUN_INSTALL_SCRIPT"
echo ""
sepurator sepurator
touch "/.runnedInstall" touch "/.runnedInstall"
fi fi
@@ -164,7 +155,6 @@ function run_prometheus_exporter() {
create_folder_and_change_permissions "/var/log/" create_folder_and_change_permissions "/var/log/"
echo "* STARTING Prometheus Exporter for Borg Backup" echo "* STARTING Prometheus Exporter for Borg Backup"
echo ""
crontab -l > /tmp/cron_bkp crontab -l > /tmp/cron_bkp
echo "" >> /tmp/cron_bkp echo "" >> /tmp/cron_bkp
@@ -184,16 +174,16 @@ function run_prometheus_exporter() {
sepurator sepurator
fi fi
} }
############################################################################################################################## #####################################################################################################
# Main Code # Main Code
############################################################################################################################## #####################################################################################################
add_borg_user add_borg_user
print_container_info print_container_info
print_user_info print_user_info
sepurator sepurator
make_and_import_ssh_keys make_and_import_ssh_keys
sepurator
generate_host_sshkey generate_host_sshkey
sepurator sepurator
@@ -205,5 +195,5 @@ run_install_script
echo "* Init done! - Starting SSH-Daemon..." echo "* Init done! - Starting SSH-Daemon..."
sepurator sepurator
echo ""
exec /usr/sbin/sshd -D -e "$@" 2> /var/log/sshd.log exec /usr/sbin/sshd -D -e "$@" #2> /var/log/sshd.log