mirror of
https://github.com/bashclub/zamba-lxc-toolbox.git
synced 2025-12-06 11:08:45 +00:00
Compare commits
2 Commits
3e257d0534
...
9a076c575a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a076c575a | ||
|
|
9a644fd149 |
@@ -24,29 +24,71 @@ apt_repo() {
|
|||||||
apt_key_url=$2
|
apt_key_url=$2
|
||||||
apt_key_path=/usr/share/keyrings/${apt_name}.gpg
|
apt_key_path=/usr/share/keyrings/${apt_name}.gpg
|
||||||
apt_repo_url=$3
|
apt_repo_url=$3
|
||||||
|
apt_suites=$4
|
||||||
|
apt_components=$5
|
||||||
|
tmp_key_file=$(mktemp)
|
||||||
|
if ! curl -fsSL -o "${tmp_key_file}" "${apt_key_url}"; then
|
||||||
|
echo "❌ Fehler beim Herunterladen des Schlüssels."
|
||||||
|
rm -f "${tmp_key_file}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if file "${tmp_key_file}" | grep -q "ASCII"; then
|
||||||
|
echo "🔍 Format erkannt: ASCII. Konvertiere den Schlüssel..."
|
||||||
|
# Wenn es ASCII ist, konvertiere es mit --dearmor
|
||||||
|
if sudo gpg --dearmor -o "${apt_key_path}" "${tmp_key_file}"; then
|
||||||
|
echo "✅ Schlüssel erfolgreich nach ${apt_key_path} konvertiert."
|
||||||
|
else
|
||||||
|
echo "❌ Fehler bei der Konvertierung des ASCII-Schlüssels."
|
||||||
|
rm -f "${tmp_key_file}" # Temporäre Datei aufräumen
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "🔍 Format erkannt: Binär. Kopiere den Schlüssel direkt..."
|
||||||
|
# Wenn es kein ASCII ist, gehen wir von Binär aus und verschieben die Datei
|
||||||
|
if sudo mv "${tmp_key_file}" "${apt_key_path}"; then
|
||||||
|
echo "✅ Schlüssel erfolgreich nach ${apt_key_path} kopiert."
|
||||||
|
else
|
||||||
|
echo "❌ Fehler beim Kopieren des binären Schlüssels."
|
||||||
|
rm -f "${tmp_key_file}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
wget -q -O - ${apt_key_url} | gpg --dearmor -o ${apt_key_path}
|
if [[ $(lsb_release -r | cut -f2) -gt 12 ]]; then
|
||||||
echo "deb [signed-by=${apt_key_path}] ${apt_repo_url}" > /etc/apt/sources.list.d/${apt_name}.list
|
cat << EOF > /etc/apt/sources.list.d/${apt_name}.sources
|
||||||
|
Types: deb
|
||||||
|
URIs: $apt_repo_url
|
||||||
|
Suites: $apt_suites
|
||||||
|
Components: $apt_components
|
||||||
|
Enabled: yes
|
||||||
|
Signed-By: $apt_key_path
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
echo "deb [signed-by=${apt_key_path}] ${apt_repo_url} ${apt_suites} ${apt_components}" > /etc/apt/sources.list.d/${apt_name}.list
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#### Set repo and install Nginx ####
|
#### Set repo and install Nginx ####
|
||||||
inst_nginx() {
|
inst_nginx() {
|
||||||
apt_repo "nginx" "https://nginx.org/keys/nginx_signing.key" "http://nginx.org/packages/mainline/debian $(lsb_release -cs) nginx"
|
apt_repo "nginx" "https://nginx.org/keys/nginx_signing.key" "http://nginx.org/packages/mainline/debian" "$(lsb_release -cs)" "nginx"
|
||||||
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends nginx
|
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends nginx
|
||||||
}
|
}
|
||||||
|
|
||||||
#### Set repo and install PHP ####
|
#### Set repo and install PHP ####
|
||||||
inst_php() {
|
inst_php() {
|
||||||
curl -sSLo /usr/share/keyrings/sury_php.gpg https://packages.sury.org/php/apt.gpg
|
apt_repo "php" "https://packages.sury.org/php/apt.gpg" "https://packages.sury.org/php/" "$(lsb_release -sc)" "main"
|
||||||
echo "deb [signed-by=/usr/share/keyrings/sury_php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/sury_php.list
|
|
||||||
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends php-common php$NEXTCLOUD_PHP_VERSION-{fpm,gd,curl,pgsql,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,mysql,redis,smbclient,sqlite3,cli,common,opcache,readline}
|
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends php-common php$NEXTCLOUD_PHP_VERSION-{fpm,gd,curl,pgsql,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,mysql,redis,smbclient,sqlite3,cli,common,opcache,readline}
|
||||||
}
|
}
|
||||||
|
|
||||||
#### Set repo and install Postgresql ####
|
#### Set repo and install Postgresql ####
|
||||||
inst_postgresql() {
|
inst_postgresql() {
|
||||||
apt_repo "postgresql" "https://www.postgresql.org/media/keys/ACCC4CF8.asc" "http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main"
|
apt_repo "postgresql" "https://www.postgresql.org/media/keys/ACCC4CF8.asc" "http://apt.postgresql.org/pub/repos/apt" "$(lsb_release -cs)-pgdg" "main"
|
||||||
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends postgresql-$POSTGRES_VERSION
|
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends postgresql-$POSTGRES_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
#### Set repo and install Crowdsec ####
|
#### Set repo and install Crowdsec ####
|
||||||
inst_crowdsec() {
|
inst_crowdsec() {
|
||||||
apt_repo "crowdsec" "https://packagecloud.io/crowdsec/crowdsec/gpgkey" " https://packagecloud.io/crowdsec/crowdsec/any any main"
|
apt_repo "crowdsec" "https://packagecloud.io/crowdsec/crowdsec/gpgkey" "https://packagecloud.io/crowdsec/crowdsec/any" "any" "main"
|
||||||
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends crowdsec
|
apt update && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends crowdsec
|
||||||
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends crowdsec-firewall-bouncer-nftables
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends crowdsec-firewall-bouncer-nftables
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,29 +24,7 @@ EOF
|
|||||||
locale-gen $LXC_LOCALE
|
locale-gen $LXC_LOCALE
|
||||||
|
|
||||||
# Generate sources
|
# Generate sources
|
||||||
if [ "$LXC_TEMPLATE_VERSION" == "debian-10-standard" ] ; then
|
if [ "$LXC_TEMPLATE_VERSION" == "debian-12-standard" ] ; then
|
||||||
|
|
||||||
cat << EOF > /etc/apt/sources.list
|
|
||||||
deb http://deb.debian.org/debian/ buster main contrib
|
|
||||||
|
|
||||||
deb http://deb.debian.org/debian/ buster-updates main contrib
|
|
||||||
|
|
||||||
# security updates
|
|
||||||
deb http://security.debian.org/debian-security buster/updates main contrib
|
|
||||||
EOF
|
|
||||||
|
|
||||||
elif [ "$LXC_TEMPLATE_VERSION" == "debian-11-standard" ] ; then
|
|
||||||
|
|
||||||
cat << EOF > /etc/apt/sources.list
|
|
||||||
deb http://deb.debian.org/debian/ bullseye main contrib
|
|
||||||
|
|
||||||
deb http://deb.debian.org/debian/ bullseye-updates main contrib
|
|
||||||
|
|
||||||
# security updates
|
|
||||||
deb http://security.debian.org/debian-security bullseye-security main contrib
|
|
||||||
EOF
|
|
||||||
|
|
||||||
elif [ "$LXC_TEMPLATE_VERSION" == "debian-12-standard" ] ; then
|
|
||||||
|
|
||||||
cat << EOF > /etc/apt/sources.list
|
cat << EOF > /etc/apt/sources.list
|
||||||
deb http://deb.debian.org/debian/ bookworm main contrib
|
deb http://deb.debian.org/debian/ bookworm main contrib
|
||||||
@@ -56,6 +34,24 @@ deb http://deb.debian.org/debian/ bookworm-updates main contrib
|
|||||||
# security updates
|
# security updates
|
||||||
deb http://security.debian.org/debian-security bookworm-security main contrib
|
deb http://security.debian.org/debian-security bookworm-security main contrib
|
||||||
EOF
|
EOF
|
||||||
|
elif [ "$LXC_TEMPLATE_VERSION" == "debian-13-standard" ] ; then
|
||||||
|
|
||||||
|
if [ -f /etc/apt/sources.list ] ; then rm /etc/apt/sources.list ; fi
|
||||||
|
cat << EOF > /etc/apt/sources.list.d/debian.sources
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: https://deb.debian.org/debian
|
||||||
|
Suites: trixie trixie-updates
|
||||||
|
Components: main non-free-firmware contrib non-free
|
||||||
|
Enabled: yes
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: https://security.debian.org/debian-security
|
||||||
|
Suites: trixie-security
|
||||||
|
Components: main non-free-firmware contrib non-free
|
||||||
|
Enabled: yes
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
|
|
||||||
else echo "LXC Debian Version false. Please check configuration files!" ; exit
|
else echo "LXC Debian Version false. Please check configuration files!" ; exit
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user