Skip to content

Commit

Permalink
Update configure script to support other os than Debian/Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
meienberger committed May 25, 2022
1 parent 71aaa7f commit d2f32b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 38 deletions.
37 changes: 4 additions & 33 deletions scripts/configure.sh
Expand Up @@ -14,39 +14,10 @@ echo "=============== TIPI ================="
echo "======================================"
echo

sudo apt-get update
sudo apt-get install -y jq coreutils ca-certificates curl gnupg lsb-release

LSB="$(lsb_release -is)"

# Add docker gpg key (Debian)
if [[ "${LSB}" == "Debian" ]]; then
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
fi

# Add docker gpg key (Ubuntu)
if [[ "${LSB}" == "Ubuntu" ]]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
fi

# Add deb repo for docker (Debian)
if [[ "${LSB}" == "Debian" ]]; then
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
fi

# Add deb repo for docker (Ubuntu)
if [[ "${LSB}" == "Ubuntu" ]]; then
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
fi

sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

# Install docker compose if not here
if ! command -v docker-compose >/dev/null; then
sudo curl -L "https://github.com/docker/compose/releases/download/v2.3.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
sudo wget -O /usr/local/bin/pacapt https://github.com/icy/pacapt/raw/ng/pacapt
sudo chmod 755 /usr/local/bin/pacapt
sudo ln -sv /usr/local/bin/pacapt /usr/local/bin/pacman || true

This comment has been minimized.

Copy link
@JTruj1ll0923

JTruj1ll0923 May 25, 2022

Contributor

This should not be run on an Arch-based system. This will either give an error or cause some damage. Instead could we just download to the ROOT_FOLDER and run from there? Like this:

`
wget -O "${ROOT_FOLDER}"/scripts/pacapt https://github.com/icy/pacapt/raw/ng/pacapt

chmod 755 "${ROOT_FOLDER}"/scripts/pacapt

sudo "${ROOT_FOLDER}"/scripts/pacapt -Sy [packages to install]
`

This comment has been minimized.

Copy link
@meienberger

meienberger May 25, 2022

Author Collaborator

Thanks for the suggestion! Wasn't aware of the issue on arch. Will make the change

sudo pacapt -Sy; sudo pacapt -S docker docker-ce docker-compose containerd.io jq coreutils curl -y

This comment has been minimized.

Copy link
@JTruj1ll0923

JTruj1ll0923 May 25, 2022

Contributor

Also something to think about if it is installed on other systems is what packages are needed. For example docker-ce and containerd.io are not packages on an arch system and give an error that fails. We could do a loop to use pacapt on each package and ignore the errors, but this would add some complexity.

This comment has been minimized.

Copy link
@meienberger

meienberger May 25, 2022

Author Collaborator

I agree, honestly I'm not very familiar with arch and I currently no machine to test it. Would be glad if you could help with that. We can make an array of packages for each distribution and loop through it with pacapt

This comment has been minimized.

Copy link
@JTruj1ll0923

JTruj1ll0923 May 27, 2022

Contributor

Yes I would be happy to help 😁


# Create configured status
touch "${ROOT_FOLDER}/state/configured"
8 changes: 3 additions & 5 deletions scripts/start.sh
Expand Up @@ -120,11 +120,6 @@ fi
# Get dns ip if pihole is installed
str=$(get_json_field ${STATE_FOLDER}/apps.json installed)

# if pihole is present in str add it as DNS
# if [[ $str = *"pihole"* ]]; then
# DNS_IP=10.21.21.201
# fi

# Create seed file with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
if [[ ! -f "${STATE_FOLDER}/seed" ]]; then
echo "Generating seed..."
Expand Down Expand Up @@ -167,6 +162,9 @@ mv -f "$ENV_FILE" "$ROOT_FOLDER/.env"
echo "Running system-info.sh..."
bash "${ROOT_FOLDER}/scripts/system-info.sh"

# Add crontab to run system-info.sh every minute
! (crontab -l | grep -q "${ROOT_FOLDER}/scripts/system-info.sh") && (crontab -l; echo "* * * * * ${ROOT_FOLDER}/scripts/system-info.sh") | crontab -

## Don't run if config-only
if [[ ! $ci == "true" ]]; then

Expand Down

0 comments on commit d2f32b8

Please sign in to comment.