瀏覽代碼

Update configure script to support other os than Debian/Ubuntu

Nicolas Meienberger 3 年之前
父節點
當前提交
d2f32b8f08
共有 2 個文件被更改,包括 7 次插入38 次删除
  1. 4 33
      scripts/configure.sh
  2. 3 5
      scripts/start.sh

+ 4 - 33
scripts/configure.sh

@@ -14,39 +14,10 @@ echo "=============== TIPI ================="
 echo "======================================"
 echo "======================================"
 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
+sudo pacapt -Sy; sudo pacapt -S docker docker-ce docker-compose containerd.io jq coreutils curl -y
 
 
 # Create configured status
 # Create configured status
 touch "${ROOT_FOLDER}/state/configured"
 touch "${ROOT_FOLDER}/state/configured"

+ 3 - 5
scripts/start.sh

@@ -120,11 +120,6 @@ fi
 # Get dns ip if pihole is installed
 # Get dns ip if pihole is installed
 str=$(get_json_field ${STATE_FOLDER}/apps.json 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
 # 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
 if [[ ! -f "${STATE_FOLDER}/seed" ]]; then
   echo "Generating seed..."
   echo "Generating seed..."
@@ -167,6 +162,9 @@ mv -f "$ENV_FILE" "$ROOT_FOLDER/.env"
 echo "Running system-info.sh..."
 echo "Running system-info.sh..."
 bash "${ROOT_FOLDER}/scripts/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
 ## Don't run if config-only
 if [[ ! $ci == "true" ]]; then
 if [[ ! $ci == "true" ]]; then