From 794210db0c35906810849a15efb65c784e0f1bb0 Mon Sep 17 00:00:00 2001 From: prokopparuzek Date: Fri, 23 Jun 2023 15:04:53 +0200 Subject: [PATCH] make more usable by BFU --- setup.sh | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/setup.sh b/setup.sh index 5c7e10c..183749f 100755 --- a/setup.sh +++ b/setup.sh @@ -1,12 +1,42 @@ #!/bin/bash # setup photoview -# run as root +# run as root if [[ $(id -u) != "0" ]]; then echo RUN AS ROOT!! exit 1 fi +# where to store photos +while getopts d:h opt; do + case $opt in + d) + PHOTOS="$OPTARG" + ;; + h) + cat <&2 + exit 1 +else + mkdir -p "$PHOTOS" +fi + # install docker apt-get update apt-get install ca-certificates curl gnupg -y @@ -19,10 +49,6 @@ echo \ apt-get update apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y -# where to store photos -read -p "Kde chcete mít fotky? [/mnt/fotky]" -PHOTOS=${REPLY:-/mnt/fotky} -echo $PHOTOS # serve at what domain read -p "Na jaké doméně budou stránky? " @@ -45,3 +71,7 @@ usermod -a -G docker ubuntu # SSH sed -E 's/^.*PasswordAuthentication yes.*$/PasswordAuthentication no/' -i /etc/ssh/sshd_config echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIq7eEoXW6aUp5kdoG3YC6EulPH9SsSemDBzyv/Tofjr amogus" >> /home/ubuntu/.ssh/authorized_keys + +# Summary +echo "Fotky jsou uloženy ve složce $PHOTOS" +echo "Photoview je dostupné na doméně $DOMAIN"