make more usable by BFU
This commit is contained in:
40
setup.sh
40
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 <<EOF
|
||||
USAGE: ./setup.sh [-d destination]
|
||||
Where to store photos.
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
PHOTOS=${PHOTOS:-/mnt/fotky}
|
||||
|
||||
# create store folder
|
||||
if [[ -d "$PHOTOS" ]]; then
|
||||
echo "Destination folder exists."
|
||||
elif [[ -f "$PHOTOS" ]]; then
|
||||
echo "Destination is file, must be folder!" >&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"
|
||||
|
||||
Reference in New Issue
Block a user