mirror of https://github.com/lukechilds/umbrel.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
213 lines
4.8 KiB
213 lines
4.8 KiB
3 years ago
|
#!/usr/bin/env bash
|
||
|
set -euo pipefail
|
||
|
|
||
|
BOOTSTRAPPED="false"
|
||
|
PRINT_WARNING="true"
|
||
|
UPDATE_APT="true"
|
||
|
INSTALL_APT_DEPS="true"
|
||
|
INSTALL_AVAHI="true"
|
||
|
INSTALL_DOCKER="true"
|
||
|
INSTALL_DOCKER_COMPOSE="true"
|
||
|
INSTALL_UMBREL="true"
|
||
|
UMBREL_VERSION="release"
|
||
|
UMBREL_REPO="getumbrel/umbrel"
|
||
|
UMBREL_INSTALL_PATH="$HOME/umbrel"
|
||
|
|
||
|
arguments=${@:-}
|
||
|
|
||
|
if [[ "${arguments}" = *"--bootstrapped"* ]]
|
||
|
then
|
||
|
BOOTSTRAPPED="true"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--no-warning"* ]]
|
||
|
then
|
||
|
PRINT_WARNING="false"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--no-install-avahi"* ]]
|
||
|
then
|
||
|
INSTALL_AVAHI="false"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--no-install-docker"* ]]
|
||
|
then
|
||
|
INSTALL_DOCKER="false"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--no-install-compose"* ]]
|
||
|
then
|
||
|
INSTALL_DOCKER_COMPOSE="false"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--no-install-umbrel"* ]]
|
||
|
then
|
||
|
INSTALL_UMBREL="false"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--no-install-deps"* ]]
|
||
|
then
|
||
|
UPDATE_APT="false"
|
||
|
INSTALL_APT_DEPS="false"
|
||
|
INSTALL_AVAHI="false"
|
||
|
INSTALL_DOCKER="false"
|
||
|
INSTALL_DOCKER_COMPOSE="false"
|
||
|
INSTALL_UMBREL="true"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--version"* ]]
|
||
|
then
|
||
|
UMBREL_VERSION="$(echo "${arguments}" | sed 's/.*--version \([^ ]*\).*/\1/')"
|
||
|
fi
|
||
|
|
||
|
if [[ "${arguments}" = *"--install-path"* ]]
|
||
|
then
|
||
|
UMBREL_INSTALL_PATH="$(echo "${arguments}" | sed 's/.*--install-path \([^ ]*\).*/\1/')"
|
||
|
fi
|
||
|
|
||
|
get_umbrel_version() {
|
||
|
version="${UMBREL_VERSION}"
|
||
|
if [[ "${version}" = "release" ]]
|
||
|
then
|
||
|
version=$(curl --silent https://api.github.com/repos/${UMBREL_REPO}/releases/latest | sed -n 's/.*"tag_name": "\([^"]*\).*/\1/p')
|
||
|
fi
|
||
|
|
||
|
echo version
|
||
|
}
|
||
|
|
||
|
bootstrap() {
|
||
|
version=$(get_umbrel_version)
|
||
|
curl --location "https://raw.githubusercontent.com/${UMBREL_REPO}/${version}/scripts/install" | \
|
||
|
bash -s -- --bootstrapped $arguments
|
||
|
}
|
||
|
|
||
|
print_warning_message() {
|
||
|
cat << 'EOF'
|
||
|
|
||
|
,;###GGGGGGGGGGl#Sp
|
||
|
,##GGGlW""^' '`""%GGGG#S,
|
||
|
,#GGG" "lGG#o
|
||
|
#GGl^ '$GG#
|
||
|
,#GGb \GGG,
|
||
|
lGG" "GGG
|
||
|
#GGGlGGGl##p,,p##lGGl##p,,p###ll##GGGG
|
||
|
!GGGlW"""*GGGGGGG#""""WlGGGGG#W""*WGGGGS
|
||
|
"" "^ '" ""
|
||
|
|
||
|
|
||
|
@GGS lG#
|
||
|
!GGG !GGG
|
||
|
!GGG !GGG
|
||
|
!GGG !GGG
|
||
|
!GGG !GGG
|
||
|
!GGG !GGG
|
||
|
'GGG $GGl
|
||
|
"GGG#psqp##GG#
|
||
|
"%GGGGGG#"
|
||
|
|
||
|
Thanks for trying out Umbrel!
|
||
|
|
||
|
This install script is for advanced users who already have an existing system they want to install Umbrel on. We recommend running Umbrel OS on a Raspberry Pi for the best experience.
|
||
|
|
||
|
Umbrel is currently in beta and is not yet safe to be exposed to the internet, it should only be run on a secure private network.
|
||
|
|
||
|
This installation method assumes a fresh Debian install. If you already have Docker or Docker Compose installed you may wish to exclude them with --no-install-docker or --no-install-compose.
|
||
|
|
||
|
You can pass flags to the installer like this:
|
||
|
|
||
|
curl https://umbrel.sh | bash -s -- --no-install-docker --no-install-compose
|
||
|
|
||
|
You may press Ctrl+C now to abort the install.
|
||
|
|
||
|
Sleeping for 30 seconds...
|
||
|
EOF
|
||
|
sleep 30
|
||
|
}
|
||
|
|
||
|
update_apt() {
|
||
|
sudo apt-get update
|
||
|
}
|
||
|
|
||
|
install_apt_deps() {
|
||
|
sudo apt-get install -y fswatch jq rsync curl git
|
||
|
}
|
||
|
|
||
|
install_avahi() {
|
||
|
sudo apt-get install -y avahi-daemon avahi-discover libnss-mdns
|
||
|
}
|
||
|
|
||
|
install_docker() {
|
||
|
# Install Docker
|
||
|
curl -fsSL https://get.docker.com | sudo sh
|
||
|
# Add current suer to Docker group
|
||
|
sudo usermod -aG docker $USER
|
||
|
# Load new group instantly
|
||
|
newgrp docker
|
||
|
}
|
||
|
|
||
|
install_docker_compose() {
|
||
|
compose_path="/usr/local/bin/docker-compose"
|
||
|
sudo curl --location "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o "${compose_path}"
|
||
|
sudo chmod +x "${compose_path}"
|
||
|
}
|
||
|
|
||
|
install_umbrel() {
|
||
|
version=$(get_umbrel_version)
|
||
|
curl --location "https://api.github.com/repos/${UMBREL_REPO}/tarball/${version}" | \
|
||
|
tar --extract --gzip --strip-components=1 --directory="${INSTALL_PATH}"
|
||
|
}
|
||
|
|
||
|
main() {
|
||
|
if [[ "${BOOTSTRAPPED}" = "false" ]]
|
||
|
then
|
||
|
bootstrap
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
if [[ "${PRINT_WARNING}" = "true" ]]
|
||
|
then
|
||
|
print_warning_message
|
||
|
fi
|
||
|
|
||
|
if [[ "${INSTALL_UMBREL}" = "true" ]]
|
||
|
then
|
||
|
mkdir -p "${INSTALL_PATH}"
|
||
|
if [[ "$(ls --almost-all "${INSTALL_PATH}")" ]]
|
||
|
then
|
||
|
echo "Error: Umbrel install path \"${INSTALL_PATH}\" already contains files"
|
||
|
exit 1
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
if [[ "${UPDATE_APT}" = "true" ]]
|
||
|
then
|
||
|
update_apt
|
||
|
fi
|
||
|
|
||
|
if [[ "${INSTALL_APT_DEPS}" = "true" ]]
|
||
|
then
|
||
|
install_apt_deps
|
||
|
fi
|
||
|
|
||
|
if [[ "${INSTALL_AVAHI}" = "true" ]]
|
||
|
then
|
||
|
install_avahi
|
||
|
fi
|
||
|
|
||
|
if [[ "${INSTALL_DOCKER}" = "true" ]]
|
||
|
then
|
||
|
install_docker
|
||
|
fi
|
||
|
|
||
|
if [[ "${INSTALL_DOCKER_COMPOSE}" = "true" ]]
|
||
|
then
|
||
|
install_docker_compose
|
||
|
fi
|
||
|
|
||
|
if [[ "${INSTALL_UMBREL}" = "true" ]]
|
||
|
then
|
||
|
install_umbrel
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
main
|