diff --git a/CHANGELOG.MD b/CHANGELOG.MD index bb61be63..0bab3311 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -3,6 +3,38 @@ # Change Log All notable changes to this project will be documented in this file. +## 2022-09-11 + +### Changed + +- **Trilium LXC** + - NEW Script + +## 2022-09-10 + +### Changed + +- **Syncthing LXC** + - NEW Script + +## 2022-09-09 + +### Changed + +- **CasaOS LXC** + - NEW Script +- **Proxmox Kernel Clean** + - Now works with Proxmox Backup Server + +## 2022-09-08 + +### Changed + +- **Navidrome LXC** + - NEW Script +- **Homepage LXC** + - NEW Script + ## 2022-08-31 ### Changed diff --git a/README.md b/README.md index 13f0a434..a2dc7774 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@

Always remember to use due diligence when sourcing scripts and automation tasks from third-party sites.

- πŸ”Έ +
Proxmox VE 7 Post Install @@ -865,8 +866,7 @@ advanced: Run in the LXC console ```yaml -cd /opt/zigbee2mqtt -npm start +cd /opt/zigbee2mqtt && npm start ``` βš™οΈ **To update Zigbee2MQTT** @@ -1126,6 +1126,36 @@ ________________________________________________________________________________
+
+ πŸ”ΈCasaOS LXC + +

+ +

CasaOS LXC

+ +[CasaOS](https://www.casaos.io/) is a community-based open source software focused on delivering simple home cloud experience around Docker ecosystem. + + +To create a new Proxmox CasaOS LXC, run the following in the Proxmox Shell. + +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/casaos-v4.sh)" +``` + +

⚑ Default Settings: 2GB RAM - 8GB Storage - 2vCPU ⚑

+ +**CasaOS Interface - IP** + +βš™οΈ **To Update CasaOS** + +```yaml +update from the CasaOS UI +``` + +____________________________________________________________________________________________ + +
+
Debian LXC @@ -1245,34 +1275,6 @@ ________________________________________________________________________________
-
- MeshCentral LXC - -

- -

MeshCentral LXC

- -MeshCentral is a full computer management web site. With MeshCentral, you can run your own web server to remotely manage and control computers on a local network or anywhere on the internet. - -To create a new Proxmox MeshCentral LXC, run the following in the Proxmox Shell. - -```yaml -bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/meshcentral-v4.sh)" -``` - -

⚑ Default Settings: 512MiB RAM - 2GB Storage - 1vCPU ⚑

- -**MeshCentral Interface - http:// IP** - -βš™οΈ **To Update MeshCentral** - -```yaml -Update from the MeshCentral UI -``` -____________________________________________________________________________________________ - -
-
Plex Media Server LXC @@ -1505,6 +1507,36 @@ ________________________________________________________________________________
+
+ πŸ”ΈTrilium LXC + +

+ +

Trilium LXC

+ +[Trilium](https://github.com/zadam/trilium#trilium-notes) is a hierarchical note taking application with focus on building large personal knowledge bases. + +To create a new Proxmox Trilium LXC, run the following in the Proxmox Shell. + +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/trilium-v4.sh)" +``` + +

⚑ Default Settings: 512MiB RAM - 2GB Storage - 1vCPU ⚑

+ +**Trilium Interface - IP:8080** + +βš™οΈ **To Update Trilium** + +Run in the LXC Console +```yaml +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/trilium-update.sh)" +``` + +____________________________________________________________________________________________ + +
+
Wiki.js LXC @@ -1557,6 +1589,36 @@ ________________________________________________________________________________
+
+ Homepage LXC + + +

Homepage LXC

+ +[Homepage](https://github.com/benphelps/homepage) is a self-hosted dashboard. + +To create a new Proxmox Homepage LXC, run the following in the Proxmox Shell. + +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/homepage-v4.sh)" +``` + +

⚑ Default Settings: 1GB RAM - 3GB Storage - 2vCPU ⚑

+ +[Configuration](https://github.com/benphelps/homepage/wiki) (bookmarks.yaml, services.yaml, widgets.yaml) path: `/opt/homepage/config/` + +**Homepage Interface - IP:3000** + +βš™οΈ **To Update Homepage** + +Run in the LXC console +```yaml +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/homepage-update.sh)" +``` + +____________________________________________________________________________________________ + +
Dashy LXC @@ -1689,6 +1751,38 @@ ________________________________________________________________________________
+
+ Navidrome LXC + +

+ +

Navidrome LXC

+ +[Navidrome](https://www.navidrome.org/) allows you to enjoy your music collection from anywhere, by making it available through a modern Web UI and through a wide range of third-party compatible mobile apps, for both iOS and Android devices. + +To create a new Proxmox Navidrome LXC, run the following in the Proxmox Shell. + +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/navidrome-v4.sh)" +``` + +

⚑ Default Settings: 1GB RAM - 4GB Storage - 2vCPU ⚑

+ +To change Navidrome music folder path, edit: `/var/lib/navidrome/navidrome.toml` + +**Navidrome Interface - IP:4533** + +βš™οΈ **To Update Navidrome** + +Run in the LXC Console +```yaml +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/navidrome-update.sh)" +``` + +____________________________________________________________________________________________ + +
+
PhotoPrism LXC @@ -1876,11 +1970,42 @@ bash /etc/webmin/uninstall.sh ``` ___________________________________________________________________________________________ +
+ +
+ πŸ”ΈSyncthing LXC + +

+ +

Syncthing LXC

+ +[Syncthing](https://syncthing.net/) is a continuous file synchronization program. It synchronizes files between two or more computers. + +To create a new Proxmox Syncthing LXC, run the following in the Proxmox Shell. + +```yaml +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/syncthing-v4.sh)" +``` + +

⚑ Default Settings: 2GB RAM - 8GB Storage - 2vCPU ⚑

+ +βš™οΈ For the initial start, run `syncthing --gui-address=0.0.0.0:8384` in the LXC console, then go to the LXC IP:8384 In settings set the LXC IP address under the GUI (also set the GUI Authentication User and GUI Authentication Password) and Connections tab's and save. Reboot the LXC. + +**Syncthing Interface - IP:8384** + +βš™οΈ **To Update Syncthing** + +```yaml +apt update && apt upgrade -y +``` + +____________________________________________________________________________________________ +
WireGuard LXC - +

WireGuard LXC

@@ -1929,6 +2054,35 @@ ________________________________________________________________________________
+ +
+ MeshCentral LXC + +

+ +

MeshCentral LXC

+ +[MeshCentral](https://meshcentral.com/info/) is a full computer management web site. With MeshCentral, you can run your own web server to remotely manage and control computers on a local network or anywhere on the internet. + +To create a new Proxmox MeshCentral LXC, run the following in the Proxmox Shell. + +```yaml +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/meshcentral-v4.sh)" +``` + +

⚑ Default Settings: 512MiB RAM - 2GB Storage - 1vCPU ⚑

+ +**MeshCentral Interface - http:// IP** + +βš™οΈ **To Update MeshCentral** + +```yaml +Update from the MeshCentral UI +``` +____________________________________________________________________________________________ + +
+
Tailscale @@ -2091,5 +2245,3 @@ bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/web-vault- ____________________________________________________________________________________________
- -[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/D1D7EP4GF) diff --git a/ct/adguard-v4.sh b/ct/adguard-v4.sh index bb40f982..e54d84aa 100644 --- a/ct/adguard-v4.sh +++ b/ct/adguard-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} Setup should be reachable by going to the following URL. ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/casaos-v4.sh b/ct/casaos-v4.sh new file mode 100644 index 00000000..344b3534 --- /dev/null +++ b/ct/casaos-v4.sh @@ -0,0 +1,260 @@ +#!/usr/bin/env bash +echo -e "Loading..." +APP="CasaOS" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="11" +NSAPP=$(echo ${APP,,} | tr -d ' ') +var_install="${NSAPP}-install" +NEXTID=$(pvesh get /cluster/nextid) +INTEGER='^[0-9]+$' +YW=`echo "\033[33m"` +BL=`echo "\033[36m"` +RD=`echo "\033[01;31m"` +BGN=`echo "\033[4;92m"` +GN=`echo "\033[1;92m"` +DGN=`echo "\033[32m"` +CL=`echo "\033[m"` +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}βœ“${CL}" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} +if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then + echo "User selected Yes" +else + clear + echo -e "⚠ User exited script \n" + exit +fi +function header_info { +cat << "EOF" + ______ ____ _____ + / ____/___ __v4______ _/ __ \/ ___/ + / / / __ `/ ___/ __ `/ / / /\__ \ +/ /___/ /_/ (__ ) /_/ / /_/ /___/ / +\____/\__,_/____/\__,_/\____//____/ + +EOF +} +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function PVE_CHECK() { + PVE=$(pveversion | grep "pve-manager/7" | wc -l) +if [[ $PVE != 1 ]]; then + echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}" + echo -e "Exiting..." + sleep 2 + exit +fi +} +function default_settings() { + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" + echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" + PW="" + echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" + CT_ID=$NEXTID + echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}" + HN=$NSAPP + echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}" + DISK_SIZE="$var_disk" + echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}" + CORE_COUNT="$var_cpu" + echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}" + RAM_SIZE="$var_ram" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + BRG="vmbr0" + echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}" + NET=dhcp + echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}" + GATE="" + echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" + MAC="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" + echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" +} +function advanced_settings() { +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ +3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" +else + exit +fi +PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" +else + PW="-password $PW1" + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" + fi +fi +CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +else + exit +fi +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + HN=$(echo ${CT_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +else + exit +fi +DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" + if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; +else + exit +fi +CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +else + exit +fi +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +else + exit +fi +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +else + exit +fi +NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +else + exit +fi +GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $GATE1 ]; then GATE1="Default" GATE=""; + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" +else + GATE=",gw=$GATE1" + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" + fi +fi +MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $MAC1 ]; then MAC1="Default" MAC=""; + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" +else + MAC=",hwaddr=$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi +fi +VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" +else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi +fi +if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then + echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}" +else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +function start_script() { +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings +else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +clear +start_script +if [ "$CT_TYPE" == "1" ]; then + FEATURES="nesting=1,keyctl=1" + else + FEATURES="nesting=1" + fi +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +export CTID=$CT_ID +export PCT_OSTYPE=$var_os +export PCT_OSVERSION=$var_version +export PCT_DISK_SIZE=$DISK_SIZE +export PCT_OPTIONS=" + -features $FEATURES + -hostname $HN + -net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN + -onboot 1 + -cores $CORE_COUNT + -memory $RAM_SIZE + -unprivileged $CT_TYPE + $PW +" +bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit +LXC_CONFIG=/etc/pve/lxc/${CTID}.conf +cat <> $LXC_CONFIG +lxc.cgroup2.devices.allow: a +lxc.cap.drop: +EOF +msg_info "Starting LXC Container" +pct start $CTID +msg_ok "Started LXC Container" +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit +IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') +pct set $CTID -description "# ${APP} LXC +### https://tteck.github.io/Proxmox/ +" +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP} ${CL} \n" diff --git a/ct/daemonsync-v4.sh b/ct/daemonsync-v4.sh index 3fee2a6e..07334f6a 100644 --- a/ct/daemonsync-v4.sh +++ b/ct/daemonsync-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8084${CL} \n" diff --git a/ct/dashy-v4.sh b/ct/dashy-v4.sh index 5383cf97..07232766 100644 --- a/ct/dashy-v4.sh +++ b/ct/dashy-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:4000${CL} \n" diff --git a/ct/debian-v4.sh b/ct/debian-v4.sh index fb470b8a..ddc48a91 100644 --- a/ct/debian-v4.sh +++ b/ct/debian-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,5 +247,6 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} ${var_version} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" diff --git a/ct/deconz-v4.sh b/ct/deconz-v4.sh index 28db39a2..c7a671bf 100644 --- a/ct/deconz-v4.sh +++ b/ct/deconz-v4.sh @@ -70,8 +70,7 @@ fi } function default_settings() { echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" - - echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" + echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" CT_TYPE="0" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" PW="" @@ -272,7 +271,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}${CL}\n" diff --git a/ct/docker-v4.sh b/ct/docker-v4.sh index d83382b7..5534f38a 100644 --- a/ct/docker-v4.sh +++ b/ct/docker-v4.sh @@ -69,9 +69,8 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" - echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" PW="" echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -263,5 +252,6 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" diff --git a/ct/emby-v4.sh b/ct/emby-v4.sh index ed9c62b4..6ea1bcec 100644 --- a/ct/emby-v4.sh +++ b/ct/emby-v4.sh @@ -71,8 +71,7 @@ fi } function default_settings() { echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" - - echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" + echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" CT_TYPE="0" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" PW="" @@ -271,7 +270,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8096${CL}\n" diff --git a/ct/esphome-v4.sh b/ct/esphome-v4.sh index e6488c95..9172c085 100644 --- a/ct/esphome-v4.sh +++ b/ct/esphome-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:6052${CL} \n" diff --git a/ct/grafana-v4.sh b/ct/grafana-v4.sh index 7ed70c2c..d2622f59 100644 --- a/ct/grafana-v4.sh +++ b/ct/grafana-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/grocy-v4.sh b/ct/grocy-v4.sh index 680bcc4a..54755899 100644 --- a/ct/grocy-v4.sh +++ b/ct/grocy-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}${CL} \n" diff --git a/ct/heimdalldashboard-v4.sh b/ct/heimdalldashboard-v4.sh index 3b5c52bd..4c534619 100644 --- a/ct/heimdalldashboard-v4.sh +++ b/ct/heimdalldashboard-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:7990${CL} \n" diff --git a/ct/homeassistant-v4.sh b/ct/homeassistant-v4.sh index 17ff5cdc..3b2083ad 100644 --- a/ct/homeassistant-v4.sh +++ b/ct/homeassistant-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -263,7 +252,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8123${CL} diff --git a/ct/homebridge-v4.sh b/ct/homebridge-v4.sh index 87b60dcb..abbee6a9 100644 --- a/ct/homebridge-v4.sh +++ b/ct/homebridge-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8581${CL} \n" diff --git a/ct/homepage-v4.sh b/ct/homepage-v4.sh new file mode 100644 index 00000000..97df3d81 --- /dev/null +++ b/ct/homepage-v4.sh @@ -0,0 +1,255 @@ +#!/usr/bin/env bash +echo -e "Loading..." +APP="Homepage" +var_disk="3" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="11" +NSAPP=$(echo ${APP,,} | tr -d ' ') +var_install="${NSAPP}-install" +NEXTID=$(pvesh get /cluster/nextid) +INTEGER='^[0-9]+$' +YW=`echo "\033[33m"` +BL=`echo "\033[36m"` +RD=`echo "\033[01;31m"` +BGN=`echo "\033[4;92m"` +GN=`echo "\033[1;92m"` +DGN=`echo "\033[32m"` +CL=`echo "\033[m"` +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}βœ“${CL}" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} +if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then + echo "User selected Yes" +else + clear + echo -e "⚠ User exited script \n" + exit +fi +function header_info { +cat << "EOF" + __ __ + / / / /___ ____ ___ ___ ____ ____ _____ ____ + / /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \ + / __ / /_/ / / / / / / __/ /_/ / /_/ / /_/ / __/ +/_/ /_/\____/_/ /_/ /_/\___/ .___/\__,_/\__, /\___/ + /_/ v4 /____/ +EOF +} +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function PVE_CHECK() { + PVE=$(pveversion | grep "pve-manager/7" | wc -l) +if [[ $PVE != 1 ]]; then + echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}" + echo -e "Exiting..." + sleep 2 + exit +fi +} +function default_settings() { + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" + echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" + PW="" + echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" + CT_ID=$NEXTID + echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}" + HN=$NSAPP + echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}" + DISK_SIZE="$var_disk" + echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}" + CORE_COUNT="$var_cpu" + echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}" + RAM_SIZE="$var_ram" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + BRG="vmbr0" + echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}" + NET=dhcp + echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}" + GATE="" + echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" + MAC="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" + echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" +} +function advanced_settings() { +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ +3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" +else + exit +fi +PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" +else + PW="-password $PW1" + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" + fi +fi +CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +else + exit +fi +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + HN=$(echo ${CT_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +else + exit +fi +DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" + if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; +else + exit +fi +CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +else + exit +fi +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +else + exit +fi +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +else + exit +fi +NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +else + exit +fi +GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $GATE1 ]; then GATE1="Default" GATE=""; + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" +else + GATE=",gw=$GATE1" + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" + fi +fi +MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $MAC1 ]; then MAC1="Default" MAC=""; + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" +else + MAC=",hwaddr=$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi +fi +VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" +else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi +fi +if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then + echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}" +else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +function start_script() { +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings +else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +clear +start_script +if [ "$CT_TYPE" == "1" ]; then + FEATURES="nesting=1,keyctl=1" + else + FEATURES="nesting=1" + fi +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +export CTID=$CT_ID +export PCT_OSTYPE=$var_os +export PCT_OSVERSION=$var_version +export PCT_DISK_SIZE=$DISK_SIZE +export PCT_OPTIONS=" + -features $FEATURES + -hostname $HN + -net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN + -onboot 1 + -cores $CORE_COUNT + -memory $RAM_SIZE + -unprivileged $CT_TYPE + $PW +" +bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit +msg_info "Starting LXC Container" +pct start $CTID +msg_ok "Started LXC Container" +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit +IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') +pct set $CTID -description "# ${APP} LXC +### https://tteck.github.io/Proxmox/ +" +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/influxdb-v4.sh b/ct/influxdb-v4.sh index f7b0fa7a..7f9f991e 100644 --- a/ct/influxdb-v4.sh +++ b/ct/influxdb-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,5 +247,6 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" diff --git a/ct/iobroker-v4.sh b/ct/iobroker-v4.sh index 7b56f873..364cf6e1 100644 --- a/ct/iobroker-v4.sh +++ b/ct/iobroker-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8081${CL} \n" diff --git a/ct/jellyfin-v4.sh b/ct/jellyfin-v4.sh index 210bfdf9..bee0357b 100644 --- a/ct/jellyfin-v4.sh +++ b/ct/jellyfin-v4.sh @@ -270,7 +270,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8096${CL}\n" diff --git a/ct/keycloak-v4.sh b/ct/keycloak-v4.sh index 61954dae..2c5db5a9 100644 --- a/ct/keycloak-v4.sh +++ b/ct/keycloak-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/magicmirror-v4.sh b/ct/magicmirror-v4.sh index 9f81130a..06aee016 100644 --- a/ct/magicmirror-v4.sh +++ b/ct/magicmirror-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/mariadb-v4.sh b/ct/mariadb-v4.sh index effb77bf..771db328 100644 --- a/ct/mariadb-v4.sh +++ b/ct/mariadb-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "Adminer should be reachable by going to the following URL. ${BL}http://${IP}/adminer/${CL} \n" diff --git a/ct/meshcentral-v4.sh b/ct/meshcentral-v4.sh index 35ef4971..602a6db5 100644 --- a/ct/meshcentral-v4.sh +++ b/ct/meshcentral-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}${CL} \n" diff --git a/ct/motioneye-v4.sh b/ct/motioneye-v4.sh index 0ce01077..7a53e637 100644 --- a/ct/motioneye-v4.sh +++ b/ct/motioneye-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8765${CL} \n" diff --git a/ct/mqtt-v4.sh b/ct/mqtt-v4.sh index 01638788..899552a9 100644 --- a/ct/mqtt-v4.sh +++ b/ct/mqtt-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,5 +247,6 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" diff --git a/ct/n8n-v4.sh b/ct/n8n-v4.sh index 5cdcc286..d683c6fd 100644 --- a/ct/n8n-v4.sh +++ b/ct/n8n-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:5678${CL} \n" diff --git a/ct/navidrome-v4.sh b/ct/navidrome-v4.sh new file mode 100644 index 00000000..4cb19868 --- /dev/null +++ b/ct/navidrome-v4.sh @@ -0,0 +1,254 @@ +#!/usr/bin/env bash +echo -e "Loading..." +APP="Navidrome" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="11" +NSAPP=$(echo ${APP,,} | tr -d ' ') +var_install="${NSAPP}-install" +NEXTID=$(pvesh get /cluster/nextid) +INTEGER='^[0-9]+$' +YW=`echo "\033[33m"` +BL=`echo "\033[36m"` +RD=`echo "\033[01;31m"` +BGN=`echo "\033[4;92m"` +GN=`echo "\033[1;92m"` +DGN=`echo "\033[32m"` +CL=`echo "\033[m"` +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}βœ“${CL}" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} +if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then + echo "User selected Yes" +else + clear + echo -e "⚠ User exited script \n" + exit +fi +function header_info { +cat << "EOF" + _ __ _ __ + / | / /___ __ v4__(_)___/ /________ ____ ___ ___ + / |/ / __ / | / / / __ / ___/ __ \/ __ __ \/ _ \ + / /| / /_/ /| |/ / / /_/ / / / /_/ / / / / / / __/ +/_/ |_/\__,_/ |___/_/\__,_/_/ \____/_/ /_/ /_/\___/ +EOF +} +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function PVE_CHECK() { + PVE=$(pveversion | grep "pve-manager/7" | wc -l) +if [[ $PVE != 1 ]]; then + echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}" + echo -e "Exiting..." + sleep 2 + exit +fi +} +function default_settings() { + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" + echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" + PW="" + echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" + CT_ID=$NEXTID + echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}" + HN=$NSAPP + echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}" + DISK_SIZE="$var_disk" + echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}" + CORE_COUNT="$var_cpu" + echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}" + RAM_SIZE="$var_ram" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + BRG="vmbr0" + echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}" + NET=dhcp + echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}" + GATE="" + echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" + MAC="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" + echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" +} +function advanced_settings() { +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ +3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" +else + exit +fi +PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" +else + PW="-password $PW1" + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" + fi +fi +CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +else + exit +fi +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + HN=$(echo ${CT_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +else + exit +fi +DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" + if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; +else + exit +fi +CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +else + exit +fi +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +else + exit +fi +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +else + exit +fi +NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +else + exit +fi +GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $GATE1 ]; then GATE1="Default" GATE=""; + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" +else + GATE=",gw=$GATE1" + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" + fi +fi +MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $MAC1 ]; then MAC1="Default" MAC=""; + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" +else + MAC=",hwaddr=$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi +fi +VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" +else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi +fi +if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then + echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}" +else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +function start_script() { +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings +else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +clear +start_script +if [ "$CT_TYPE" == "1" ]; then + FEATURES="nesting=1,keyctl=1" + else + FEATURES="nesting=1" + fi +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +export CTID=$CT_ID +export PCT_OSTYPE=$var_os +export PCT_OSVERSION=$var_version +export PCT_DISK_SIZE=$DISK_SIZE +export PCT_OPTIONS=" + -features $FEATURES + -hostname $HN + -net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN + -onboot 1 + -cores $CORE_COUNT + -memory $RAM_SIZE + -unprivileged $CT_TYPE + $PW +" +bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit +msg_info "Starting LXC Container" +pct start $CTID +msg_ok "Started LXC Container" +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit +IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') +pct set $CTID -description "# ${APP} LXC +### https://tteck.github.io/Proxmox/ +" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:4533${CL} \n" diff --git a/ct/nginx-proxy-manager-v4.sh b/ct/nginx-proxy-manager-v4.sh index 39ffe521..bea15edf 100644 --- a/ct/nginx-proxy-manager-v4.sh +++ b/ct/nginx-proxy-manager-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/nginx-proxy-manager-install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:81${CL} \n" diff --git a/ct/nocodb-v4.sh b/ct/nocodb-v4.sh index 08e6fd4b..050e5ff9 100644 --- a/ct/nocodb-v4.sh +++ b/ct/nocodb-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8080/dashboard${CL} \n" diff --git a/ct/node-red-v4.sh b/ct/node-red-v4.sh index 04aba883..9230148b 100644 --- a/ct/node-red-v4.sh +++ b/ct/node-red-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:1880${CL} \n" diff --git a/ct/omada-v4.sh b/ct/omada-v4.sh index 6236796c..f4f1a9af 100644 --- a/ct/omada-v4.sh +++ b/ct/omada-v4.sh @@ -70,9 +70,8 @@ fi } function default_settings() { echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" - - echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" PW="" echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" @@ -93,8 +92,8 @@ function default_settings() { GATE="" echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" MAC="" - echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" - VLAN="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { @@ -261,7 +260,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}https://${IP}:8043${CL} \n" diff --git a/ct/openhab-v4.sh b/ct/openhab-v4.sh index 128a0223..e724c8e3 100644 --- a/ct/openhab-v4.sh +++ b/ct/openhab-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/photoprism-v4.sh b/ct/photoprism-v4.sh index 9ffc9399..cbfa9b92 100644 --- a/ct/photoprism-v4.sh +++ b/ct/photoprism-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:2342${CL} \n" diff --git a/ct/pihole-v4.sh b/ct/pihole-v4.sh index 60dd7c25..d917e1f5 100644 --- a/ct/pihole-v4.sh +++ b/ct/pihole-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" CT_TYPE="0" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}/admin${CL} \n" diff --git a/ct/plex-v4.sh b/ct/plex-v4.sh index 9c43b82c..cad50e02 100644 --- a/ct/plex-v4.sh +++ b/ct/plex-v4.sh @@ -270,7 +270,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:32400/web${CL}\n" diff --git a/ct/podman-homeassistant-v4.sh b/ct/podman-homeassistant-v4.sh index 6c97d5d8..55efec47 100644 --- a/ct/podman-homeassistant-v4.sh +++ b/ct/podman-homeassistant-v4.sh @@ -73,7 +73,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" CT_TYPE="0" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -101,16 +100,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ @@ -267,7 +256,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8123${CL} diff --git a/ct/postgresql-v4.sh b/ct/postgresql-v4.sh index 7d8c4d13..230fa91f 100644 --- a/ct/postgresql-v4.sh +++ b/ct/postgresql-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "Adminer should be reachable by going to the following URL. ${BL}http://${IP}/adminer/${CL} \n" diff --git a/ct/prometheus-v4.sh b/ct/prometheus-v4.sh index 554e531f..587412e9 100644 --- a/ct/prometheus-v4.sh +++ b/ct/prometheus-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:9090${CL} \n" diff --git a/ct/syncthing-v4.sh b/ct/syncthing-v4.sh new file mode 100644 index 00000000..27d73050 --- /dev/null +++ b/ct/syncthing-v4.sh @@ -0,0 +1,256 @@ +#!/usr/bin/env bash +echo -e "Loading..." +APP="Syncthing" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="11" +NSAPP=$(echo ${APP,,} | tr -d ' ') +var_install="${NSAPP}-install" +NEXTID=$(pvesh get /cluster/nextid) +INTEGER='^[0-9]+$' +YW=`echo "\033[33m"` +BL=`echo "\033[36m"` +RD=`echo "\033[01;31m"` +BGN=`echo "\033[4;92m"` +GN=`echo "\033[1;92m"` +DGN=`echo "\033[32m"` +CL=`echo "\033[m"` +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}βœ“${CL}" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} +if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then + echo "User selected Yes" +else + clear + echo -e "⚠ User exited script \n" + exit +fi +function header_info { +cat << "EOF" + _____ __ __ _ + / ___/__ ______v4_____/ /_/ /_ (_)___ ____ _ + \__ \/ / / / __ \/ ___/ __/ __ \/ / __ \/ __ `/ + ___/ / /_/ / / / / /__/ /_/ / / / / / / / /_/ / +/____/\__, /_/ /_/\___/\__/_/ /_/_/_/ /_/\__, / + /____/ /____/ + +EOF +} +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function PVE_CHECK() { + PVE=$(pveversion | grep "pve-manager/7" | wc -l) +if [[ $PVE != 1 ]]; then + echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}" + echo -e "Exiting..." + sleep 2 + exit +fi +} +function default_settings() { + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" + echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" + PW="" + echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" + CT_ID=$NEXTID + echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}" + HN=$NSAPP + echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}" + DISK_SIZE="$var_disk" + echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}" + CORE_COUNT="$var_cpu" + echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}" + RAM_SIZE="$var_ram" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + BRG="vmbr0" + echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}" + NET=dhcp + echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}" + GATE="" + echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" + MAC="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" + echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" +} +function advanced_settings() { +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ +3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" +else + exit +fi +PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" +else + PW="-password $PW1" + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" + fi +fi +CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +else + exit +fi +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + HN=$(echo ${CT_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +else + exit +fi +DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" + if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; +else + exit +fi +CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +else + exit +fi +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +else + exit +fi +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +else + exit +fi +NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +else + exit +fi +GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $GATE1 ]; then GATE1="Default" GATE=""; + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" +else + GATE=",gw=$GATE1" + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" + fi +fi +MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $MAC1 ]; then MAC1="Default" MAC=""; + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" +else + MAC=",hwaddr=$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi +fi +VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" +else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi +fi +if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then + echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}" +else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +function start_script() { +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings +else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +clear +start_script +if [ "$CT_TYPE" == "1" ]; then + FEATURES="nesting=1,keyctl=1" + else + FEATURES="nesting=1" + fi +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +export CTID=$CT_ID +export PCT_OSTYPE=$var_os +export PCT_OSVERSION=$var_version +export PCT_DISK_SIZE=$DISK_SIZE +export PCT_OPTIONS=" + -features $FEATURES + -hostname $HN + -net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN + -onboot 1 + -cores $CORE_COUNT + -memory $RAM_SIZE + -unprivileged $CT_TYPE + $PW +" +bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit +msg_info "Starting LXC Container" +pct start $CTID +msg_ok "Started LXC Container" +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit +IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') +pct set $CTID -description "# ${APP} LXC +### https://tteck.github.io/Proxmox/ +" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8384 ${CL} (after initial start) \n" diff --git a/ct/technitiumdns-v4.sh b/ct/technitiumdns-v4.sh index fa20dafc..e7f78fd4 100644 --- a/ct/technitiumdns-v4.sh +++ b/ct/technitiumdns-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:5380${CL} \n" diff --git a/ct/trilium-v4.sh b/ct/trilium-v4.sh new file mode 100644 index 00000000..8dc66c67 --- /dev/null +++ b/ct/trilium-v4.sh @@ -0,0 +1,255 @@ +#!/usr/bin/env bash +echo -e "Loading..." +APP="Trilium" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="11" +NSAPP=$(echo ${APP,,} | tr -d ' ') +var_install="${NSAPP}-install" +NEXTID=$(pvesh get /cluster/nextid) +INTEGER='^[0-9]+$' +YW=`echo "\033[33m"` +BL=`echo "\033[36m"` +RD=`echo "\033[01;31m"` +BGN=`echo "\033[4;92m"` +GN=`echo "\033[1;92m"` +DGN=`echo "\033[32m"` +CL=`echo "\033[m"` +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}βœ“${CL}" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} +if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then + echo "User selected Yes" +else + clear + echo -e "⚠ User exited script \n" + exit +fi +function header_info { +cat << "EOF" + ______ _ ___ + /_ __/_v4_(_) (_)_ ______ ___ + / / / ___/ / / / / / / __ `__ \ + / / / / / / / / /_/ / / / / / / +/_/ /_/ /_/_/_/\__,_/_/ /_/ /_/ + +EOF +} +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function PVE_CHECK() { + PVE=$(pveversion | grep "pve-manager/7" | wc -l) +if [[ $PVE != 1 ]]; then + echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}" + echo -e "Exiting..." + sleep 2 + exit +fi +} +function default_settings() { + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" + echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" + PW="" + echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" + CT_ID=$NEXTID + echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}" + HN=$NSAPP + echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}" + DISK_SIZE="$var_disk" + echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}" + CORE_COUNT="$var_cpu" + echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}" + RAM_SIZE="$var_ram" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + BRG="vmbr0" + echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}" + NET=dhcp + echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}" + GATE="" + echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" + MAC="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" + echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" +} +function advanced_settings() { +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ +3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" +else + exit +fi +PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" +else + PW="-password $PW1" + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" + fi +fi +CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +else + exit +fi +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + HN=$(echo ${CT_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +else + exit +fi +DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" + if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; +else + exit +fi +CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +else + exit +fi +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +else + exit +fi +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +else + exit +fi +NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +else + exit +fi +GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $GATE1 ]; then GATE1="Default" GATE=""; + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" +else + GATE=",gw=$GATE1" + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" + fi +fi +MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $MAC1 ]; then MAC1="Default" MAC=""; + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" +else + MAC=",hwaddr=$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi +fi +VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3) +exitstatus=$? +if [ $exitstatus = 0 ]; then + if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" +else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi +fi +if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then + echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}" +else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +function start_script() { +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings +else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings +fi +} +clear +start_script +if [ "$CT_TYPE" == "1" ]; then + FEATURES="nesting=1,keyctl=1" + else + FEATURES="nesting=1" + fi +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +export CTID=$CT_ID +export PCT_OSTYPE=$var_os +export PCT_OSVERSION=$var_version +export PCT_DISK_SIZE=$DISK_SIZE +export PCT_OPTIONS=" + -features $FEATURES + -hostname $HN + -net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN + -onboot 1 + -cores $CORE_COUNT + -memory $RAM_SIZE + -unprivileged $CT_TYPE + $PW +" +bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit +msg_info "Starting LXC Container" +pct start $CTID +msg_ok "Started LXC Container" +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit +IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') +pct set $CTID -description "# ${APP} LXC +### https://tteck.github.io/Proxmox/ +" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/ubuntu-v4.sh b/ct/ubuntu-v4.sh index 8df0e0f4..f485ca4e 100644 --- a/ct/ubuntu-v4.sh +++ b/ct/ubuntu-v4.sh @@ -70,9 +70,8 @@ fi } function default_settings() { echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" - - echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" PW="" echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" @@ -261,5 +260,6 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} ${var_version} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" diff --git a/ct/unifi-v4.sh b/ct/unifi-v4.sh index 71f3ac51..d6f7b954 100644 --- a/ct/unifi-v4.sh +++ b/ct/unifi-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP}${CL} should be reachable by going to the following URL. ${BL}https://${IP}:8443${CL} \n" diff --git a/ct/uptimekuma-v4.sh b/ct/uptimekuma-v4.sh index 3a806bff..4f7f4e3b 100644 --- a/ct/uptimekuma-v4.sh +++ b/ct/uptimekuma-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:3001${CL} \n" diff --git a/ct/vaultwarden-v4.sh b/ct/vaultwarden-v4.sh index fa33cb7b..02b0f684 100644 --- a/ct/vaultwarden-v4.sh +++ b/ct/vaultwarden-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_info "Setting Container to Normal Resources" pct set $CTID -memory 512 pct set $CTID -cores 1 diff --git a/ct/whoogle-v4.sh b/ct/whoogle-v4.sh index f5dabd3e..21a1ecdf 100644 --- a/ct/whoogle-v4.sh +++ b/ct/whoogle-v4.sh @@ -69,7 +69,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -97,16 +96,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -258,7 +247,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:5000${CL} \n" diff --git a/ct/wikijs-v4.sh b/ct/wikijs-v4.sh index 32df8a0d..b41e5a4a 100644 --- a/ct/wikijs-v4.sh +++ b/ct/wikijs-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -259,7 +248,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/wireguard-v4.sh b/ct/wireguard-v4.sh index 6e2e9282..564dd218 100644 --- a/ct/wireguard-v4.sh +++ b/ct/wireguard-v4.sh @@ -71,9 +71,8 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" - echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" + echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" + CT_TYPE="1" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" PW="" echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" @@ -94,21 +93,11 @@ function default_settings() { GATE="" echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" MAC="" - echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" - VLAN="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ @@ -260,7 +249,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "WGDashboard should be reachable by going to the following URL. ${BL}http://${IP}:10086${CL} \n" diff --git a/ct/zigbee2mqtt-v4.sh b/ct/zigbee2mqtt-v4.sh index 2c5662e2..48fcc97f 100644 --- a/ct/zigbee2mqtt-v4.sh +++ b/ct/zigbee2mqtt-v4.sh @@ -70,9 +70,8 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" - echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" - CT_TYPE="0" + echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" + CT_TYPE="0" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" PW="" echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" @@ -93,21 +92,11 @@ function default_settings() { GATE="" echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" MAC="" - echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" - VLAN="" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + VLAN="" echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ @@ -269,5 +258,6 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" diff --git a/ct/zwavejs2mqtt-v4.sh b/ct/zwavejs2mqtt-v4.sh index 9854db8e..56fe0f5c 100644 --- a/ct/zwavejs2mqtt-v4.sh +++ b/ct/zwavejs2mqtt-v4.sh @@ -70,7 +70,6 @@ if [[ $PVE != 1 ]]; then fi } function default_settings() { - echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}" CT_TYPE="0" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" @@ -98,16 +97,6 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ -"10" "Buster" OFF \ -"11" "Bullseye" ON \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Debian Version: ${BGN}$var_version${CL}" -else - exit -fi CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ @@ -270,7 +259,8 @@ msg_ok "Started LXC Container" lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$var_install.sh)" || exit IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') pct set $CTID -description "# ${APP} LXC -### https://tteck.github.io/Proxmox/" +### https://tteck.github.io/Proxmox/ +" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. ${BL}http://${IP}:8091${CL} \n" diff --git a/misc/homepage-update.sh b/misc/homepage-update.sh new file mode 100644 index 00000000..7b8ac4c6 --- /dev/null +++ b/misc/homepage-update.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +YW=`echo "\033[33m"` +BL=`echo "\033[36m"` +RD=`echo "\033[01;31m"` +BGN=`echo "\033[4;92m"` +GN=`echo "\033[1;92m"` +DGN=`echo "\033[32m"` +CL=`echo "\033[m"` +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}βœ“${CL}" +APP="Homepage" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occured." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} + +while true; do + read -p "This will Update ${APP}. Proceed(y/n)?" yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done +clear +function header_info { +cat << "EOF" + __ __ + / / / /___ ____ ___ ___ ____ ____ _____ ____ + / /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \ + / __ / /_/ / / / / / / __/ /_/ / /_/ / /_/ / __/ +/_/ /_/\____/_/ /_/ /_/\___/ .___/\__,_/\__, /\___/ + /_/ UPDATE /____/ +EOF +} + +header_info + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_info "Updating ${APP}" +if ! command -v pnpm >/dev/null 2>&1; then + npm install -g pnpm &>/dev/null +fi +cd /opt/homepage +systemctl stop homepage +git pull --force &>/dev/null +pnpm install &>/dev/null +pnpm build &>/dev/null +systemctl start homepage +msg_ok "Updated ${APP}" diff --git a/misc/kernel-clean.sh b/misc/kernel-clean.sh index c804741a..212ad8e0 100644 --- a/misc/kernel-clean.sh +++ b/misc/kernel-clean.sh @@ -14,7 +14,6 @@ CM="${GN}βœ“${CL}" CROSS="${RD}βœ—${CL}" PARTY="πŸŽ‰" current_kernel=$(uname -r) -pve=$(pveversion) while true; do read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn @@ -70,7 +69,9 @@ function edge_kernel() { function kernel_info() { latest_kernel=$(dpkg --list| grep 'kernel-.*-pve' | awk '{print $2}' | tac | head -n 1) - echo -e "${YW}PVE Version: ${BL}$pve\n${CL}" + if [[ "$MODE" != "PBS" ]]; then + echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}" + fi if [[ "$current_kernel" == *"pve"* ]]; then if [[ "$latest_kernel" != *"$current_kernel"* ]]; then echo -e "${GN}Latest Kernel: $latest_kernel\n${CL}" @@ -120,4 +121,12 @@ msg_ok "Kernel Search Completed\n" fi } +if ! command -v pveversion >/dev/null 2>&1; then + echo -e " Switching to PBS mode" + MODE="PBS" + sleep 2 + else + MODE="PVE" +fi + check_root diff --git a/misc/navidrome-update.sh b/misc/navidrome-update.sh new file mode 100644 index 00000000..c3ecded7 --- /dev/null +++ b/misc/navidrome-update.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest \ +| grep "tag_name" \ +| awk '{print substr($2, 3, length($2)-4) }') + +RD=`echo "\033[01;31m"` +BL=`echo "\033[36m"` +CM='\xE2\x9C\x94\033' +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` +function update_info { +cat << "EOF" + _ __ _ __ + / | / /___ __ __(_)___/ /________ ____ ___ ___ + / |/ / __ / | / / / __ / ___/ __ \/ __ __ \/ _ \ + / /| / /_/ /| |/ / / /_/ / / / /_/ / / / / / / __/ +/_/ |_/\__,_/ |___/_/\__,_/_/ \____/_/ /_/ /_/\___/ + UPDATE + +EOF +} +update_info +while true; do + read -p "This will Update Navidrome to v$RELEASE. Proceed(y/n)?" yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done +sleep 2 +echo -e "${GN} Stopping Navidrome... ${CL}" +systemctl stop navidrome.service +sleep 1 + +echo -e "${GN} Updating to v${RELEASE}... ${CL}" +wget https://github.com/navidrome/navidrome/releases/download/v${RELEASE}/navidrome_${RELEASE}_Linux_x86_64.tar.gz -O Navidrome.tar.gz &>/dev/null +tar -xvzf Navidrome.tar.gz -C /opt/navidrome/ &>/dev/null + +echo -e "${GN} Cleaning up... ${CL}" +rm Navidrome.tar.gz + +echo -e "${GN} Starting Navidrome... ${CL}" +systemctl start navidrome.service +sleep 1 +echo -e "${GN} Finished Update ${CL}" diff --git a/misc/trilium-update.sh b/misc/trilium-update.sh new file mode 100644 index 00000000..9220c2d7 --- /dev/null +++ b/misc/trilium-update.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest \ +| grep "tag_name" \ +| awk '{print substr($2, 3, length($2)-4) }') + +RD=`echo "\033[01;31m"` +BL=`echo "\033[36m"` +CM='\xE2\x9C\x94\033' +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` +function update_info { +cat << "EOF" + ______ _ ___ + /_ __/____(_) (_)_ ______ ___ + / / / ___/ / / / / / / __ `__ \ + / / / / / / / / /_/ / / / / / / +/_/ /_/ /_/_/_/\__,_/_/ /_/ /_/ + UPDATE + +EOF +} +update_info +while true; do + read -p "This will Update Trilium to v$RELEASE. Proceed(y/n)?" yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done +sleep 2 +echo -e "${GN} Stopping Trilium... ${CL}" +systemctl stop trilium.service +sleep 1 + +echo -e "${GN} Updating to v${RELEASE}... ${CL}" +wget -q https://github.com/zadam/trilium/releases/download/v$RELEASE/trilium-linux-x64-server-$RELEASE.tar.xz + +tar -xzf trilium-linux-x64-server-$RELEASE.tar.xz -C /opt/trilium &>/dev/null + +echo -e "${GN} Cleaning up... ${CL}" +rm trilium-linux-x64-server-$RELEASE.tar.xz + +echo -e "${GN} Starting Trilium... ${CL}" +systemctl start trilium.service +sleep 1 +echo -e "${GN} Finished Update ${CL}" diff --git a/setup/casaos-install.sh b/setup/casaos-install.sh new file mode 100644 index 00000000..634a00e7 --- /dev/null +++ b/setup/casaos-install.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash +YW=`echo "\033[33m"` +RD=`echo "\033[01;31m"` +BL=`echo "\033[36m"` +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` +RETRY_NUM=10 +RETRY_EVERY=3 +NUM=$RETRY_NUM +CM="${GN}βœ“${CL}" +CROSS="${RD}βœ—${CL}" +BFR="\\r\\033[K" +HOLD="-" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +msg_info "Setting up Container OS " +sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen +locale-gen >/dev/null +while [ "$(hostname -I)" = "" ]; do + 1>&2 echo -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + ((NUM--)) + if [ $NUM -eq 0 ] + then + 1>&2 echo -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + exit 1 + fi +done +msg_ok "Set up Container OS" +msg_ok "Network Connected: ${BL}$(hostname -I)" + +if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi; +RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs) +if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi; + +msg_info "Updating Container OS" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Container OS" + +msg_info "Installing Dependencies" +apt-get install -y curl &>/dev/null +apt-get install -y sudo &>/dev/null +apt-get install -y unzip &>/dev/null +msg_ok "Installed Dependencies" + +DOCKER_CONFIG_PATH='/etc/docker/daemon.json' +mkdir -p $(dirname $DOCKER_CONFIG_PATH) +cat >$DOCKER_CONFIG_PATH <<'EOF' +{ + "log-driver": "journald" +} +EOF + +msg_info "Installing CasaOS (Patience)" +wget -qO- https://get.casaos.io | bash &>/dev/null +msg_ok "Installed CasaOS" + +PASS=$(grep -w "root" /etc/shadow | cut -b6); + if [[ $PASS != $ ]]; then +msg_info "Customizing Container" +rm /etc/motd +rm /etc/update-motd.d/10-uname +touch ~/.hushlogin +GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" +mkdir -p $(dirname $GETTY_OVERRIDE) +cat << EOF > $GETTY_OVERRIDE +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM +EOF +systemctl daemon-reload +systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') +msg_ok "Customized Container" + fi + +msg_info "Cleaning up" +apt-get autoremove >/dev/null +apt-get autoclean >/dev/null +rm -rf /var/{cache,log}/* /var/lib/apt/lists/* +msg_ok "Cleaned" diff --git a/setup/homepage-install.sh b/setup/homepage-install.sh new file mode 100644 index 00000000..2ee58a14 --- /dev/null +++ b/setup/homepage-install.sh @@ -0,0 +1,132 @@ +#!/usr/bin/env bash +YW=`echo "\033[33m"` +RD=`echo "\033[01;31m"` +BL=`echo "\033[36m"` +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` +RETRY_NUM=10 +RETRY_EVERY=3 +NUM=$RETRY_NUM +CM="${GN}βœ“${CL}" +CROSS="${RD}βœ—${CL}" +BFR="\\r\\033[K" +HOLD="-" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +msg_info "Setting up Container OS " +sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen +locale-gen >/dev/null +while [ "$(hostname -I)" = "" ]; do + 1>&2 echo -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + ((NUM--)) + if [ $NUM -eq 0 ] + then + 1>&2 echo -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + exit 1 + fi +done +msg_ok "Set up Container OS" +msg_ok "Network Connected: ${BL}$(hostname -I)" + +if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi; +RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs) +if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi; + +msg_info "Updating Container OS" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Container OS" + +msg_info "Installing Dependencies" +apt-get install -y curl &>/dev/null +apt-get install -y sudo &>/dev/null +apt-get install -y git &>/dev/null +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &>/dev/null +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +apt-get install -y nodejs &>/dev/null +npm install -g pnpm &>/dev/null +msg_ok "Installed Node.js" + +msg_info "Installing Homepage" +git clone https://github.com/benphelps/homepage.git /opt/homepage &>/dev/null +cd /opt/homepage +mkdir -p config +pnpm install &>/dev/null +pnpm build &>/dev/null +msg_ok "Installed Homepage" + +msg_info "Creating Service" +service_path="/etc/systemd/system/homepage.service" +echo "[Unit] +Description=Homepage +After=network.target +StartLimitIntervalSec=0 +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +WorkingDirectory=/opt/homepage/ +ExecStart=npm start +[Install] +WantedBy=multi-user.target" > $service_path +systemctl enable --now homepage &>/dev/null +msg_ok "Created Service" + +PASS=$(grep -w "root" /etc/shadow | cut -b6); + if [[ $PASS != $ ]]; then +msg_info "Customizing Container" +chmod -x /etc/update-motd.d/* +touch ~/.hushlogin +GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" +mkdir -p $(dirname $GETTY_OVERRIDE) +cat << EOF > $GETTY_OVERRIDE +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM +EOF +systemctl daemon-reload +systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') +msg_ok "Customized Container" + fi + +msg_info "Cleaning up" +apt-get autoremove >/dev/null +apt-get autoclean >/dev/null +rm -rf /var/{cache,log}/* /var/lib/apt/lists/* +msg_ok "Cleaned" diff --git a/setup/navidrome-install.sh b/setup/navidrome-install.sh new file mode 100644 index 00000000..21d44e78 --- /dev/null +++ b/setup/navidrome-install.sh @@ -0,0 +1,151 @@ +#!/usr/bin/env bash +YW=`echo "\033[33m"` +RD=`echo "\033[01;31m"` +BL=`echo "\033[36m"` +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` +RETRY_NUM=10 +RETRY_EVERY=3 +NUM=$RETRY_NUM +CM="${GN}βœ“${CL}" +CROSS="${RD}βœ—${CL}" +BFR="\\r\\033[K" +HOLD="-" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +msg_info "Setting up Container OS " +sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen +locale-gen >/dev/null +while [ "$(hostname -I)" = "" ]; do + 1>&2 echo -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + ((NUM--)) + if [ $NUM -eq 0 ] + then + 1>&2 echo -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + exit 1 + fi +done +msg_ok "Set up Container OS" +msg_ok "Network Connected: ${BL}$(hostname -I)" + +if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi; +RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs) +if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi; + +msg_info "Updating Container OS" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Container OS" + +msg_info "Installing Dependencies (patience)" +apt-get install -y curl &>/dev/null +apt-get install -y sudo &>/dev/null +apt-get install -y ffmpeg &>/dev/null +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest \ +| grep "tag_name" \ +| awk '{print substr($2, 3, length($2)-4) }') + +msg_info "Installing Navidrome" +sudo install -d -o root -g root /opt/navidrome +sudo install -d -o root -g root /var/lib/navidrome +wget https://github.com/navidrome/navidrome/releases/download/v${RELEASE}/navidrome_${RELEASE}_Linux_x86_64.tar.gz -O Navidrome.tar.gz &>/dev/null +sudo tar -xvzf Navidrome.tar.gz -C /opt/navidrome/ &>/dev/null +sudo chown -R root:root /opt/navidrome +mkdir -p /music +cat < /var/lib/navidrome/navidrome.toml +MusicFolder = '/music' +EOF +msg_ok "Installed Navidrome" + +msg_info "Creating Service" +service_path="/etc/systemd/system/navidrome.service" + +echo "[Unit] +Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic +After=remote-fs.target network.target +AssertPathExists=/var/lib/navidrome + +[Service] +User=root +Group=root +Type=simple +ExecStart=/opt/navidrome/navidrome --configfile '/var/lib/navidrome/navidrome.toml' +WorkingDirectory=/var/lib/navidrome +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +DevicePolicy=closed +NoNewPrivileges=yes +PrivateTmp=yes +PrivateUsers=yes +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap +ReadWritePaths=/var/lib/navidrome +ProtectSystem=full + +[Install] +WantedBy=multi-user.target" > $service_path +systemctl daemon-reload +systemctl enable --now navidrome.service &>/dev/null + +msg_ok "Created Service" + +PASS=$(grep -w "root" /etc/shadow | cut -b6); + if [[ $PASS != $ ]]; then +msg_info "Customizing Container" +chmod -x /etc/update-motd.d/* +touch ~/.hushlogin +GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" +mkdir -p $(dirname $GETTY_OVERRIDE) +cat << EOF > $GETTY_OVERRIDE +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM +EOF +systemctl daemon-reload +systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') +msg_ok "Customized Container" + fi + +msg_info "Cleaning up" +apt-get autoremove >/dev/null +apt-get autoclean >/dev/null +rm -rf /var/{cache,log}/* /var/lib/apt/lists/* /root/Navidrome.tar.gz +msg_ok "Cleaned" diff --git a/setup/syncthing-install.sh b/setup/syncthing-install.sh new file mode 100644 index 00000000..2b09475a --- /dev/null +++ b/setup/syncthing-install.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +YW=`echo "\033[33m"` +RD=`echo "\033[01;31m"` +BL=`echo "\033[36m"` +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` +RETRY_NUM=10 +RETRY_EVERY=3 +NUM=$RETRY_NUM +CM="${GN}βœ“${CL}" +CROSS="${RD}βœ—${CL}" +BFR="\\r\\033[K" +HOLD="-" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +msg_info "Setting up Container OS " +sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen +locale-gen >/dev/null +while [ "$(hostname -I)" = "" ]; do + 1>&2 echo -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + ((NUM--)) + if [ $NUM -eq 0 ] + then + 1>&2 echo -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + exit 1 + fi +done +msg_ok "Set up Container OS" +msg_ok "Network Connected: ${BL}$(hostname -I)" + +if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi; +RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs) +if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi; + +msg_info "Updating Container OS" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Container OS" + +msg_info "Installing Dependencies" +apt-get install -y curl &>/dev/null +apt-get install -y sudo &>/dev/null +apt-get install -y gnupg &>/dev/null +msg_ok "Installed Dependencies" + +msg_info "Installing Syncthing" +curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg &>/dev/null +echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list &>/dev/null +apt-get update &>/dev/null +apt-get install -y syncthing &>/dev/null +systemctl enable syncthing@root.service &>/dev/null +msg_ok "Installed Syncthing" + +PASS=$(grep -w "root" /etc/shadow | cut -b6); + if [[ $PASS != $ ]]; then +msg_info "Customizing Container" +chmod -x /etc/update-motd.d/* +touch ~/.hushlogin +GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" +mkdir -p $(dirname $GETTY_OVERRIDE) +cat << EOF > $GETTY_OVERRIDE +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM +EOF +systemctl daemon-reload +systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') +msg_ok "Customized Container" + fi + +msg_info "Cleaning up" +apt-get autoremove >/dev/null +apt-get autoclean >/dev/null +rm -rf /var/{cache,log}/* /var/lib/apt/lists/* +msg_ok "Cleaned" diff --git a/setup/trilium-install.sh b/setup/trilium-install.sh new file mode 100644 index 00000000..36524370 --- /dev/null +++ b/setup/trilium-install.sh @@ -0,0 +1,126 @@ +#!/usr/bin/env bash +YW=`echo "\033[33m"` +RD=`echo "\033[01;31m"` +BL=`echo "\033[36m"` +GN=`echo "\033[1;92m"` +CL=`echo "\033[m"` +RETRY_NUM=10 +RETRY_EVERY=3 +NUM=$RETRY_NUM +CM="${GN}βœ“${CL}" +CROSS="${RD}βœ—${CL}" +BFR="\\r\\033[K" +HOLD="-" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}β€Ό ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +msg_info "Setting up Container OS " +sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen +locale-gen >/dev/null +while [ "$(hostname -I)" = "" ]; do + 1>&2 echo -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + ((NUM--)) + if [ $NUM -eq 0 ] + then + 1>&2 echo -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + exit 1 + fi +done +msg_ok "Set up Container OS" +msg_ok "Network Connected: ${BL}$(hostname -I)" + +if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi; +RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs) +if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi; + +msg_info "Updating Container OS" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Container OS" + +msg_info "Installing Dependencies" +apt-get install -y curl &>/dev/null +apt-get install -y sudo &>/dev/null +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest \ +| grep "tag_name" \ +| awk '{print substr($2, 3, length($2)-4) }') + +msg_info "Installing Trilium" +wget -q https://github.com/zadam/trilium/releases/download/v$RELEASE/trilium-linux-x64-server-$RELEASE.tar.xz +tar -xvf trilium-linux-x64-server-$RELEASE.tar.xz &>/dev/null +mv trilium-linux-x64-server /opt/trilium +msg_ok "Installed Trilium" + +msg_info "Creating Service" +service_path="/etc/systemd/system/trilium.service" + +echo "[Unit] +Description=Trilium Daemon +After=syslog.target network.target + +[Service] +User=root +Type=simple +ExecStart=/opt/trilium/trilium.sh +WorkingDirectory=/opt/trilium/ +TimeoutStopSec=20 +Restart=always + +[Install] +WantedBy=multi-user.target" > $service_path +systemctl enable --now -q trilium +msg_ok "Created Service" + +PASS=$(grep -w "root" /etc/shadow | cut -b6); + if [[ $PASS != $ ]]; then +msg_info "Customizing Container" +chmod -x /etc/update-motd.d/* +touch ~/.hushlogin +GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" +mkdir -p $(dirname $GETTY_OVERRIDE) +cat << EOF > $GETTY_OVERRIDE +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM +EOF +systemctl daemon-reload +systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') +msg_ok "Customized Container" + fi + +msg_info "Cleaning up" +apt-get autoremove >/dev/null +apt-get autoclean >/dev/null +rm -rf /var/{cache,log}/* /var/lib/apt/lists/* /root/trilium-linux-x64-server-$RELEASE.tar.xz +msg_ok "Cleaned"