2022-12-16 23:23:07 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
echo "Installing runtipi..."
|
2023-03-02 19:19:20 +00:00
|
|
|
|
|
|
|
ARCHITECTURE="$(uname -m)"
|
|
|
|
# Not supported on 32 bits systems
|
|
|
|
if [[ "$ARCHITECTURE" == "armv7"* ]] || [[ "$ARCHITECTURE" == "i686" ]] || [[ "$ARCHITECTURE" == "i386" ]]; then
|
|
|
|
echo "runtipi is not supported on 32 bits systems"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2022-12-16 23:23:07 +00:00
|
|
|
LATEST_VERSION=$(curl -s https://api.github.com/repos/meienberger/runtipi/releases/latest | grep tag_name | cut -d '"' -f4)
|
|
|
|
|
|
|
|
### --------------------------------
|
|
|
|
### CLI arguments
|
|
|
|
### --------------------------------
|
|
|
|
UPDATE="false"
|
|
|
|
while [ -n "${1-}" ]; do
|
|
|
|
case "$1" in
|
|
|
|
--update) UPDATE="true" ;;
|
|
|
|
--)
|
|
|
|
shift # The double dash makes them parameters
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*) echo "Option $1 not recognized" && exit 1 ;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "${UPDATE}" == "false" ]]; then
|
|
|
|
mkdir -p runtipi
|
|
|
|
cd runtipi || exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
curl --location https://api.github.com/repos/meienberger/runtipi/tarball/"${LATEST_VERSION}" -o runtipi.tar.gz
|
|
|
|
mkdir runtipi-"${LATEST_VERSION}"
|
|
|
|
tar -xzf runtipi.tar.gz -C runtipi-"${LATEST_VERSION}" --strip-components=1
|
|
|
|
rm runtipi.tar.gz
|
|
|
|
|
|
|
|
# copy from downloaded /scripts/*
|
|
|
|
if [ -d "scripts" ]; then
|
|
|
|
rm -rf scripts
|
|
|
|
fi
|
|
|
|
mkdir scripts
|
|
|
|
cp -r runtipi-"${LATEST_VERSION}"/scripts/* ./scripts
|
|
|
|
|
|
|
|
# copy from downloaded /templates/*
|
|
|
|
if [ -d "templates" ]; then
|
|
|
|
rm -rf templates
|
|
|
|
fi
|
|
|
|
mkdir templates
|
|
|
|
cp -r runtipi-"${LATEST_VERSION}"/templates/* ./templates
|
|
|
|
|
|
|
|
# copy from downloaded /traefik/*
|
|
|
|
if [ -d "traefik" ]; then
|
2023-06-18 16:36:06 +00:00
|
|
|
mv traefik traefik_old
|
2022-12-16 23:23:07 +00:00
|
|
|
fi
|
|
|
|
mkdir traefik
|
|
|
|
cp -r runtipi-"${LATEST_VERSION}"/traefik/* ./traefik
|
|
|
|
|
2023-06-28 21:30:12 +00:00
|
|
|
if [ -d "traefik_old" ] && [ -d "traefik_old/tls" ]; then
|
2023-06-18 16:36:06 +00:00
|
|
|
## move old traefik TLS config to new traefik config
|
|
|
|
cp -r traefik_old/tls traefik
|
|
|
|
rm -rf traefik_old
|
|
|
|
fi
|
|
|
|
|
2022-12-16 23:23:07 +00:00
|
|
|
# copy from downloaded /docker-compose.yml
|
|
|
|
if [ -f "docker-compose.yml" ]; then
|
|
|
|
rm -f docker-compose.yml
|
|
|
|
fi
|
|
|
|
cp -r runtipi-"${LATEST_VERSION}"/docker-compose.yml .
|
|
|
|
|
|
|
|
# copy from downloaded /package.json
|
|
|
|
if [ -f "package.json" ]; then
|
|
|
|
rm -f package.json
|
|
|
|
fi
|
|
|
|
cp -r runtipi-"${LATEST_VERSION}"/package.json .
|
|
|
|
|
2023-03-02 19:19:20 +00:00
|
|
|
mkdir -p apps
|
|
|
|
mkdir -p app-data
|
2022-12-16 23:23:07 +00:00
|
|
|
mkdir -p state
|
2023-03-02 19:19:20 +00:00
|
|
|
mkdir -p repos
|
|
|
|
|
2023-06-07 19:54:24 +00:00
|
|
|
mkdir -p traefik/shared
|
|
|
|
mkdir -p traefik/tls
|
|
|
|
|
2022-12-20 18:11:52 +00:00
|
|
|
mkdir -p media/torrents
|
|
|
|
mkdir -p media/torrents/watch
|
2023-06-07 19:54:24 +00:00
|
|
|
mkdir -p media/torrents/complete
|
2022-12-20 18:11:52 +00:00
|
|
|
mkdir -p media/torrents/incomplete
|
|
|
|
|
2023-03-29 06:53:19 +00:00
|
|
|
mkdir -p media/usenet
|
|
|
|
mkdir -p media/usenet/watch
|
2023-06-07 19:54:24 +00:00
|
|
|
mkdir -p media/usenet/complete
|
2023-03-29 06:53:19 +00:00
|
|
|
mkdir -p media/usenet/incomplete
|
|
|
|
|
2023-04-02 23:30:38 +00:00
|
|
|
mkdir -p media/downloads
|
|
|
|
mkdir -p media/downloads/watch
|
2023-06-07 19:54:24 +00:00
|
|
|
mkdir -p media/downloads/complete
|
2023-04-02 23:30:38 +00:00
|
|
|
mkdir -p media/downloads/incomplete
|
|
|
|
|
2022-12-20 18:11:52 +00:00
|
|
|
mkdir -p media/data
|
|
|
|
mkdir -p media/data/books
|
2023-04-02 23:30:38 +00:00
|
|
|
mkdir -p media/data/comics
|
2022-12-20 18:11:52 +00:00
|
|
|
mkdir -p media/data/movies
|
|
|
|
mkdir -p media/data/music
|
|
|
|
mkdir -p media/data/tv
|
|
|
|
mkdir -p media/data/podcasts
|
|
|
|
mkdir -p media/data/images
|
2023-03-21 04:13:32 +00:00
|
|
|
mkdir -p media/data/roms
|
2022-12-20 18:11:52 +00:00
|
|
|
|
2022-12-16 23:23:07 +00:00
|
|
|
## remove downloaded folder
|
|
|
|
rm -rf runtipi-"${LATEST_VERSION}"
|
|
|
|
|
|
|
|
sudo ./scripts/start.sh
|