diff --git a/ct/adguard-v1.sh b/ct/adguard-v1.sh deleted file mode 100644 index daada894..00000000 --- a/ct/adguard-v1.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New AdGuard Home LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/adguard_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "LXC ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null - -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC... \e[0m" -DISK_SIZE=2G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=adguard -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 512 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC... \e[0m" -pct start $CTID -pct push $CTID adguard_setup.sh /adguard_setup.sh -perms 755 -pct exec $CTID /adguard_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created a AdGuard Home LXC to $CTID" -echo -e "\e[1;92m AdGuard Home Setup should be reachable by going to the following URL. - http://${IP}:3000 -\e[0m" diff --git a/ct/adguard-v2.sh b/ct/adguard-v2.sh deleted file mode 100644 index 9838585b..00000000 --- a/ct/adguard-v2.sh +++ /dev/null @@ -1,256 +0,0 @@ -#!/usr/bin/env bash - -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Adguard Home LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${GN} - _ _ - /\ | | | | - / \ __| | __ _ _ _ __ _ _ __ __| | - / /\ \ / _ |/ _ | | | |/ _ | __/ _ | - / ____ \ (_| | (_| | |_| | (_| | | | (_| | - /_/ \_\__,_|\__, |\__,_|\__,_|_| \__,_| - __/ | - |___/ - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname adguard - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/adguard-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Adguard Home LXC to${CL} ${BL}$CTID${CL}. -${GN}Adguard${CL} Setup should be reachable by going to the following URL. - ${BL}http://${IP}:3000${CL} \n" - diff --git a/ct/adguard-v3.sh b/ct/adguard-v3.sh deleted file mode 100644 index 26955d34..00000000 --- a/ct/adguard-v3.sh +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Adguard" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${GN} - _ _ - /\ | | | | - / \ __| | __ _ _ _ __ _ _ __ __| | - / /\ \ / _ |/ _ | | | |/ _ | __/ _ | - / ____ \ (_| | (_| | |_| | (_| | | | (_| | - /_/ \_\__,_|\__, |\__,_|\__,_|_| \__,_| - v3__/ | - |___/ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/adguard-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -pct set $CTID -description "# AdGuard Home LXC -### https://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" -echo -e "Adguard Setup should be reachable by going to the following URL. - ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/adguard-v4.sh b/ct/adguard-v4.sh index a21350c5..1b65ff63 100644 --- a/ct/adguard-v4.sh +++ b/ct/adguard-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/blocky-v4.sh b/ct/blocky-v4.sh index 07f58776..122669b1 100644 --- a/ct/blocky-v4.sh +++ b/ct/blocky-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/casaos-v4.sh b/ct/casaos-v4.sh index c3d54ea9..b6c9364a 100644 --- a/ct/casaos-v4.sh +++ b/ct/casaos-v4.sh @@ -325,7 +325,7 @@ 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/changedetection-v4.sh b/ct/changedetection-v4.sh index 0580a2cc..db179033 100644 --- a/ct/changedetection-v4.sh +++ b/ct/changedetection-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/daemonsync-v2.sh b/ct/daemonsync-v2.sh deleted file mode 100644 index 5b47dfa6..00000000 --- a/ct/daemonsync-v2.sh +++ /dev/null @@ -1,253 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Daemon Sync Server LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _____ _____ - | __ \ / ____| - | | | | __ _ ___ _ __ ___ ___ _ __ | (___ _ _ _ __ ___ - | | | |/ _ |/ _ \ _ _ \ / _ \| _ \ \___ \| | | | _ \ / __| - | |__| | (_| | __/ | | | | | (_) | | | | ____) | |_| | | | | (__ - |_____/ \__,_|\___|_| |_| |_|\___/|_| |_| |_____/ \__, |_| |_|\___| - __/ | - |___/ -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=8 -export PCT_OPTIONS=" - -features $FEATURES - -hostname daemonsync - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/daemonsync-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Daemon Sync Server LXC to${CL} ${BL}$CTID${CL}. - Daemon Sync should be reachable by going to the following URL. - ${BL}http://${IP}:8084${CL} \n" diff --git a/ct/daemonsync-v3.sh b/ct/daemonsync-v3.sh deleted file mode 100644 index df44541e..00000000 --- a/ct/daemonsync-v3.sh +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Daemon Sync" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _____ _____ - | __ \ / ____| - | | | | __ _v3___ _ __ ___ ___ _ __ | (___ _ _ _ __ ___ - | | | |/ _ |/ _ \ _ _ \ / _ \| _ \ \___ \| | | | _ \ / __| - | |__| | (_| | __/ | | | | | (_) | | | | ____) | |_| | | | | (__ - |_____/ \__,_|\___|_| |_| |_|\___/|_| |_| |_____/ \__, |_| |_|\___| - __/ | - |___/ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/daemonsync-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://github.com/tteck/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/daemonsync-v4.sh b/ct/daemonsync-v4.sh index c9c19e9b..33bc978f 100644 --- a/ct/daemonsync-v4.sh +++ b/ct/daemonsync-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/dashy-v2.sh b/ct/dashy-v2.sh deleted file mode 100644 index 49e63390..00000000 --- a/ct/dashy-v2.sh +++ /dev/null @@ -1,254 +0,0 @@ -#!/usr/bin/env bash -clear -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Dashy LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _____ _ - | __ \ | | - | | | | __ _ ___| |__ _ _ - | | | |/ _ / __| _ \| | | | - | |__| | (_| \__ \ | | | |_| | - |_____/ \__,_|___/_| |_|\__, | - __/ | - |___/ -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=3 -export PCT_OPTIONS=" - -features $FEATURES - -hostname dashy - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/dashy-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Dashy LXC to${CL} ${BL}$CTID${CL}. -${BL}Dashy${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:4000${CL} \n" diff --git a/ct/dashy-v3.sh b/ct/dashy-v3.sh deleted file mode 100644 index b7e795d2..00000000 --- a/ct/dashy-v3.sh +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Dashy" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _____ _ - | __ \ | | - | | | | __ _ ___| |__ _ _ - | | | |/ _ / __| _ \| | | | - | |__| | (_| \__ \ | | | |_| | - |_____/ \__,_|___/_| |_|\__, | - v3__/ | - |___/ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}3${CL}${DGN}GB${CL}" - DISK_SIZE="3" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 3 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="3"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/dashy-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://github.com/tteck/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/dashy-v4.sh b/ct/dashy-v4.sh index 5aac4c22..4f777b81 100644 --- a/ct/dashy-v4.sh +++ b/ct/dashy-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/debian-v1.sh b/ct/debian-v1.sh deleted file mode 100644 index c002b0c6..00000000 --- a/ct/debian-v1.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Debian 11 LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/debian11_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null - -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=2G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=debian11 -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 512\ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID debian11_setup.sh /debian11_setup.sh -perms 755 -pct exec $CTID /debian11_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created a Debian 11 LXC Container to $CTID at IP Address ${IP}" diff --git a/ct/debian-v2.sh b/ct/debian-v2.sh deleted file mode 100644 index 36ed693b..00000000 --- a/ct/debian-v2.sh +++ /dev/null @@ -1,257 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[32m"` -CL=`echo "\033[m"` -APP="Debian" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _____ _ _ - | __ \ | | (_) - | | | | ___| |__ _ __ _ _ __ - | | | |/ _ \ _ \| |/ _ | _ \ - | |__| | __/ |_) | | (_| | | | | - |_____/ \___|_.__/|_|\__,_|_| |_| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some applications may not work properly due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. \n" diff --git a/ct/debian-v3.sh b/ct/debian-v3.sh deleted file mode 100644 index 79c9bdd1..00000000 --- a/ct/debian-v3.sh +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="Debian" -var_disk="2" -var_cpu="1" -var_ram="512" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _____ _ _ - | __ \ | | (_) - | | | | ___| |__ _ __ _ _ __ - | | | |/ _ \ _ \| |/ _ | _ \ - | |__| | __/ |_) | | (_| | | | | - |_${YW}v3${RD}__/ \___|_.__/|_|\__,_|_| |_| -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" diff --git a/ct/debian-v4.sh b/ct/debian-v4.sh index c70d40dc..25501b0e 100644 --- a/ct/debian-v4.sh +++ b/ct/debian-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/deconz-v3.sh b/ct/deconz-v3.sh deleted file mode 100644 index 3679fb6c..00000000 --- a/ct/deconz-v3.sh +++ /dev/null @@ -1,371 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="deCONZ" -var_disk="4" -var_cpu="2" -var_ram="1024" -var_os="ubuntu" -var_version="20.04" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _____ - | | / ____| - __| | v3_| | ___ _ __ ____ - / _ |/ _ \ | / _ \| _ \|_ / - | (_| | __/ |___| (_) | | | |/ / - \__,_|\___|\_____\___/|_| |_/___| -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Unprivileged" - CT_TYPE="1" - echo -en "${DGN}Set CT Type ${BL}Unprivileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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: -lxc.cgroup2.devices.allow: c 188:* rwm -lxc.cgroup2.devices.allow: c 189:* rwm -lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir -lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file -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://github.com/tteck/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/deconz-v4.sh b/ct/deconz-v4.sh index 9faf169b..0a373336 100644 --- a/ct/deconz-v4.sh +++ b/ct/deconz-v4.sh @@ -324,7 +324,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/docker-v2.sh b/ct/docker-v2.sh deleted file mode 100644 index 43ceb81b..00000000 --- a/ct/docker-v2.sh +++ /dev/null @@ -1,312 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Docker LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _____ _ - | __ \ | | - | | | | ___ ___| | _____ _ __ - | | | |/ _ \ / __| |/ / _ \ __| - | |__| | (_) | (__| < __/ | - |_____/ \___/ \___|_|\_\___|_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${RD} If Using ZFS, You Have Storage Driver Options${CL}\n" - printf " ${RD} Non ZFS, Select Standard overlay2 Storage Driver${CL}\n" - printf " ${YW} 1)${GN} Use fuse-overlayfs Storage Driver${CL}\n" - printf " ${YW} 2)${GN} Use Standard overlay2 Storage Driver${CL}\n" - - printf "Please choose a Storage Driver and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using fuse-overlayfs Storage Driver"; - STORAGE_DRIVER="fuse" - break; - ;; - 2) clear; - header_info; - option_picked "Using overlay2 Storage Driver"; - STORAGE_DRIVER=" " - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Storage Driver from the menu"; - show_menu3; - ;; - esac - done -show_menu4(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message4=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" - printf " ${YW}${message4}${CL}\n" -} -show_menu4 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu4; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ] && [ "$STORAGE_DRIVER" == " " ]; then - FEATURES="nesting=1,keyctl=1" - elif - [ "$IM" == "1" ] && [ "$STORAGE_DRIVER" == "fuse" ]; then - FEATURES="nesting=1,keyctl=1,fuse=1" - elif - [ "$IM" == "0" ] && [ "$STORAGE_DRIVER" == "fuse" ]; then - FEATURES="nesting=1,fuse=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname docker - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - wget -qL -O fuse-overlayfs https://github.com/containers/fuse-overlayfs/releases/download/v1.8.2/fuse-overlayfs-x86_64 - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - - if [ "$STORAGE_TYPE" == "zfspool" ] && [ "$STORAGE_DRIVER" == "fuse" ]; then - pct push $CTID fuse-overlayfs /usr/local/bin/fuse-overlayfs -perms 755 - info "Using ${BL}fuse-overlayfs${CL} Storage Driver." - else - info "Using ${BL}overlay2${CL} Storage Driver." - fi - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/docker-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Docker LXC to${CL} ${BL}$CTID${CL}. \n" diff --git a/ct/docker-v3.sh b/ct/docker-v3.sh deleted file mode 100644 index 3c2c71a4..00000000 --- a/ct/docker-v3.sh +++ /dev/null @@ -1,361 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Docker" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _____ _ - | __ \ | | - | | | | ___ ___| | _____ _ __ - | |v3| |/ _ \ / __| |/ / _ \ __| - | |__| | (_) | (__| < __/ | - |_____/ \___/ \___|_|\_\___|_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -PVE_CHECK -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/docker-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" diff --git a/ct/docker-v4.sh b/ct/docker-v4.sh index 326fb3f9..fcaf2469 100644 --- a/ct/docker-v4.sh +++ b/ct/docker-v4.sh @@ -336,7 +336,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/emby-v4.sh b/ct/emby-v4.sh index 6ad8344e..c1461b71 100644 --- a/ct/emby-v4.sh +++ b/ct/emby-v4.sh @@ -331,7 +331,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/emqx-v4.sh b/ct/emqx-v4.sh index ee621375..21499816 100644 --- a/ct/emqx-v4.sh +++ b/ct/emqx-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/esphome-v1.sh b/ct/esphome-v1.sh deleted file mode 100644 index 902c9969..00000000 --- a/ct/esphome-v1.sh +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env bash - -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` - -while true; do - read -p "This will create a New ESPHome LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${CL} - ______ _____ _____ _ _ ____ __ __ ______ - | ____|/ ____| __ \| | | |/ __ \| \/ | ____| - | |__ | (___ | |__) | |__| | | | | \ / | |__ - | __| \___ \| ___/| __ | | | | |\/| | __| - | |____ ____) | | | | | | |__| | | | | |____ - |______|_____/|_| |_| |_|\____/|_| |_|______| - -${CL}" -} - -header_info - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/esphome_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using ${BL}$STORAGE${CL} for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is ${BL}$CTID.${CL}" - -echo -en "${GN} Updating LXC Template List... " -pveam update >/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Downloading LXC Template... " -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} -echo -e "${CM}${CL} \r" - -echo -en "${GN} Creating LXC Container... " -DISK_SIZE=4G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=esphome -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 1024 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT -echo -e "${CM}${CL} \r" - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -pct push $CTID esphome_setup.sh /esphome_setup.sh -perms 755 -echo -e "${CM}${CL} \r" -pct exec $CTID /esphome_setup.sh - - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created ESPHome LXC Container to ${BL}$CTID${CL}" -echo -e "${CL} ESPHome should be reachable by going to the following URL. - ${BL}http://${IP}:6052${CL} -\n" diff --git a/ct/esphome-v2.sh b/ct/esphome-v2.sh deleted file mode 100644 index 8fcbf29b..00000000 --- a/ct/esphome-v2.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="ESPHome" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - ______ _____ _____ _ _ ____ __ __ ______ - | ____|/ ____| __ \| | | |/ __ \| \/ | ____| - | |__ | (___ | |__) | |__| | | | | \ / | |__ - | __| \___ \| ___/| __ | | | | |\/| | __| - | |____ ____) | | | | | | |__| | | | | |____ - |______|_____/|_| |_| |_|\____/|_| |_|______| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:6052${CL} \n" diff --git a/ct/esphome-v3.sh b/ct/esphome-v3.sh deleted file mode 100644 index b39f4f07..00000000 --- a/ct/esphome-v3.sh +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="ESPHome" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - ______ _____ _____ _ _ ____ __ __ ______ - | ____|/ ____| __ \| | | |/ __ \| \/ | ____| - | |__ | (___ | |__) | |__| | | | | \ / | |__ - | __| \___ \| ___/| __ | | | | |\/| | __| - | |____ ____) | | | | | | |__| | | | | |____ - |______|_____/|_| v3 |_| |_|\____/|_| |_|______| - -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/esphome-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://github.com/tteck/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/esphome-v4.sh b/ct/esphome-v4.sh index d7e7350d..ff206eec 100644 --- a/ct/esphome-v4.sh +++ b/ct/esphome-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/grafana-v2.sh b/ct/grafana-v2.sh deleted file mode 100644 index 04d65207..00000000 --- a/ct/grafana-v2.sh +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Grafana LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _____ __ - / ____| / _| - | | __ _ __ __ _| |_ __ _ _ __ __ _ - | | |_ | __/ _ | _/ _ | _ \ / _ | - | |__| | | | (_| | || (_| | | | | (_| | - \_____|_| \__,_|_| \__,_|_| |_|\__,_| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname grafana - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/grafana-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Grafana LXC to${CL} ${BL}$CTID${CL}. -${BL}Grafana${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/grafana-v3.sh b/ct/grafana-v3.sh deleted file mode 100644 index cf708a67..00000000 --- a/ct/grafana-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Grafana" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _____ __ - / ____| / _| - | | __ _ __ __ _| |_ __ _ _ __ __ _ - | | |_ | __/ _ | _/ _ | _ \ / _ | - | |__| | | | (_| | || (_| | | | | (_| | - \_____|_|v3\__,_|_| \__,_|_| |_|\__,_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/grafana-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://github.com/tteck/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/grafana-v4.sh b/ct/grafana-v4.sh index 68a8488d..f72fd3cf 100644 --- a/ct/grafana-v4.sh +++ b/ct/grafana-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/grocy-v3.sh b/ct/grocy-v3.sh deleted file mode 100644 index 38f6b555..00000000 --- a/ct/grocy-v3.sh +++ /dev/null @@ -1,359 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="grocy" -var_disk="2" -var_cpu="1" -var_ram="512" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - __ _ _ __ ___ ___ _ _ - / _ | __/ _ \ / __| | | | - | (_| | | | (_) | (__| |_| | - \__, |_| \___/ \___|\__, | - __/ | v3 __/ | - |___/ |___/ -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/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/grocy-v4.sh b/ct/grocy-v4.sh index 7b4fae30..3c0f7e0e 100644 --- a/ct/grocy-v4.sh +++ b/ct/grocy-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/heimdalldashboard-v2.sh b/ct/heimdalldashboard-v2.sh deleted file mode 100644 index 1a60e74c..00000000 --- a/ct/heimdalldashboard-v2.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env bash -PP=`echo "\e[1;35m"` -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="Heimdall Dashboard" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${PP} - _ _ _ _ _ _ _____ _ _ _ - | | | | (_) | | | | | | __ \ | | | | | | - | |__| | ___ _ _ __ ___ __| | __ _| | | | | | | __ _ ___| |__ | |__ ___ __ _ _ __ __| | - | __ |/ _ \ | _ _ \ / _ |/ _ | | | | | | |/ _ / __| _ \| _ \ / _ \ / _ | __/ _ | - | | | | __/ | | | | | | (_| | (_| | | | | |__| | (_| \__ \ | | | |_) | (_) | (_| | | | (_| | - |_| |_|\___|_|_| |_| |_|\__,_|\__,_|_|_| |_____/ \__,_|___/_| |_|_.__/ \___/ \__,_|_| \__,_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and press [ENTER] or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and press [ENTER] or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and press [ENTER] or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press [ENTER]." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:7990${CL} \n" diff --git a/ct/heimdalldashboard-v3.sh b/ct/heimdalldashboard-v3.sh deleted file mode 100644 index 1a1eb641..00000000 --- a/ct/heimdalldashboard-v3.sh +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -PP=`echo "\e[1;35m"` -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="Heimdall Dashboard" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${PP} - _ _ _ _ _ _ _____ _ _ _ - | | | | (_) | | | | | | __ \ | | | | | | - | |__| | ___ _ _ __ ___ __| | __v3| | | | | | | __ _ ___| |__ | |__ ___ __ _ _ __ __| | - | __ |/ _ \ | _ _ \ / _ |/ _ | | | | | | |/ _ / __| _ \| _ \ / _ \ / _ | __/ _ | - | | | | __/ | | | | | | (_| | (_| | | | | |__| | (_| \__ \ | | | |_) | (_) | (_| | | | (_| | - |_| |_|\___|_|_| |_| |_|\__,_|\__,_|_|_| |_____/ \__,_|___/_| |_|_.__/ \___/ \__,_|_| \__,_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/heimdalldashboard-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://github.com/tteck/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/heimdalldashboard-v4.sh b/ct/heimdalldashboard-v4.sh index 410d50fa..6c4b3492 100644 --- a/ct/heimdalldashboard-v4.sh +++ b/ct/heimdalldashboard-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/homeassistant-core-v4.sh b/ct/homeassistant-core-v4.sh index df5f2408..684577a7 100644 --- a/ct/homeassistant-core-v4.sh +++ b/ct/homeassistant-core-v4.sh @@ -324,7 +324,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/homeassistant-v1.sh b/ct/homeassistant-v1.sh deleted file mode 100644 index 40c7652e..00000000 --- a/ct/homeassistant-v1.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Home Assistant Container LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/ha_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=8G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - wget -qL -O fuse-overlayfs https://github.com/containers/fuse-overlayfs/releases/download/v1.8.2/fuse-overlayfs-x86_64 - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi - ARCH=$(dpkg --print-architecture) -HOSTNAME=homeassistant -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -if [ "$STORAGE_TYPE" == "zfspool" ]; then - CT_FEATURES="fuse=1,keyctl=1,mknod=1,nesting=1" -else - CT_FEATURES="nesting=1" -fi -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features $CT_FEATURES \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -if [ "$STORAGE_TYPE" == "zfspool" ]; then -pct push $CTID fuse-overlayfs /usr/local/bin/fuse-overlayfs -perms 755 -info "Using fuse-overlayfs." -fi -pct push $CTID ha_setup.sh /ha_setup.sh -perms 755 -pct exec $CTID /ha_setup.sh -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully Created Home Assistant Container LXC to $CTID." -msg " - -Home Assistant should be reachable by going to the following URL. - - http://${IP}:8123 -" diff --git a/ct/homeassistant-v2.sh b/ct/homeassistant-v2.sh deleted file mode 100644 index 938b6921..00000000 --- a/ct/homeassistant-v2.sh +++ /dev/null @@ -1,316 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[94m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Home Assistant Container LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _ _ _ _ - | | (_) | | | | - | |__ ___ _ __ ___ ___ __ _ ___ ___ _ ___| |_ __ _ _ __ | |_ - | _ \ / _ \| _ _ \ / _ \/ _ / __/ __| / __| __/ _ | _ \| __| - | | | | (_) | | | | | | __/ (_| \__ \__ \ \__ \ || (_| | | | | |_ - |_| |_|\___/|_| |_| |_|\___|\__,_|___/___/_|___/\__\__,_|_| |_|\__| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${RD} If Using ZFS, You Have Storage Driver Options${CL}\n" - printf " ${RD} Non ZFS, Select Standard overlay2 Storage Driver${CL}\n" - printf " ${YW} 1)${GN} Use fuse-overlayfs Storage Driver${CL}\n" - printf " ${YW} 2)${GN} Use Standard overlay2 Storage Driver${CL}\n" - - printf "Please choose a Storage Driver and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using fuse-overlayfs Storage Driver"; - STORAGE_DRIVER="fuse" - break; - ;; - 2) clear; - header_info; - option_picked "Using overlay2 Storage Driver"; - STORAGE_DRIVER=" " - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Storage Driver from the menu"; - show_menu3; - ;; - esac - done -show_menu4(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message4=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" - printf " ${YW}${message4}${CL}\n" -} -show_menu4 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu4; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ] && [ "$STORAGE_DRIVER" == " " ]; then - FEATURES="nesting=1,keyctl=1" - elif - [ "$IM" == "1" ] && [ "$STORAGE_DRIVER" == "fuse" ]; then - FEATURES="nesting=1,keyctl=1,fuse=1" - elif - [ "$IM" == "0" ] && [ "$STORAGE_DRIVER" == "fuse" ]; then - FEATURES="nesting=1,fuse=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=16 -export PCT_OPTIONS=" - -features $FEATURES - -hostname homeassistant - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - wget -qL -O fuse-overlayfs https://github.com/containers/fuse-overlayfs/releases/download/v1.8.2/fuse-overlayfs-x86_64 - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - - if [ "$STORAGE_TYPE" == "zfspool" ] && [ "$STORAGE_DRIVER" == "fuse" ]; then - pct push $CTID fuse-overlayfs /usr/local/bin/fuse-overlayfs -perms 755 - info "Using ${BL}fuse-overlayfs${CL} Storage Driver." - else - info "Using ${BL}overlay2${CL} Storage Driver." - fi - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/homeassistant-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Home Assistant Container LXC to${CL} ${BL}$CTID${CL}. -${BL}Home Assistant${CL} should be reachable by going to the following URL. - - ${BL}http://${IP}:8123${CL} \n" diff --git a/ct/homeassistant-v3.sh b/ct/homeassistant-v3.sh deleted file mode 100644 index ad4dc553..00000000 --- a/ct/homeassistant-v3.sh +++ /dev/null @@ -1,365 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Home Assistant" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _ _ _ _ - | | ${YW}v3${CL}${BL} (_) | | | | - | |__ ___ _ __ ___ ___ __ _ ___ ___ _ ___| |_ __ _ _ __ | |_ - | _ \ / _ \| _ _ \ / _ \/ _ / __/ __| / __| __/ _ | _ \| __| - | | | | (_) | | | | | | __/ (_| \__ \__ \ \__ \ || (_| | | | | |_ - |_| |_|\___/|_| |_| |_|\___|\__,_|___/___/_|___/\__\__,_|_| |_|\__| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}16${CL}${DGN}GB${CL}" - DISK_SIZE="16" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 16 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="16"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -PVE_CHECK -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/homeassistant-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" -echo -e "${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:8123${CL} -Portainer should be reachable by going to the following URL. - ${BL}http://${IP}:9000${CL}\n" diff --git a/ct/homeassistant-v4.sh b/ct/homeassistant-v4.sh index dece5d89..23577ce7 100644 --- a/ct/homeassistant-v4.sh +++ b/ct/homeassistant-v4.sh @@ -336,7 +336,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/homebridge-v2.sh b/ct/homebridge-v2.sh deleted file mode 100644 index 3e045697..00000000 --- a/ct/homebridge-v2.sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Homebridge LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _ ____ __ __ ______ ____ _____ _____ _____ _____ ______ - | | | |/ __ \| \/ | ____| _ \| __ \|_ _| __ \ / ____| ____| - | |__| | | | | \ / | |__ | |_) | |__) | | | | | | | | __| |__ - | __ | | | | |\/| | __| | _ <| _ / | | | | | | | |_ | __| - | | | | |__| | | | | |____| |_) | | \ \ _| |_| |__| | |__| | |____ - |_| |_|\____/|_| |_|______|____/|_| \_\_____|_____/ \_____|______| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname homebridge - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/homebridge-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Homebridge LXC to${CL} ${BL}$CTID${CL}. -${BL}Homebridge${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:8581${CL} \n" diff --git a/ct/homebridge-v3.sh b/ct/homebridge-v3.sh deleted file mode 100644 index 629a9a19..00000000 --- a/ct/homebridge-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Homebridge" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _ ____ __ __ ______ ____ _____ _____ _____ _____ ______ - | | | |/ __ \| \/ | ____| _ \| __ \|_ _| __ \ / ____| ____| - | |__| | | | | \ / | |__ | |_) | |__) | | | | | | | | __| |__ - | __ | | | | |\/| | __| | _ <| _ / | | | | | | | |_ | __| - | | | | |__| | | | | |____| |_) | | \ \ _| |_| |__| | |__| | |____ - |_|v3|_|\____/|_| |_|______|____/|_| \_\_____|_____/ \_____|______| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/homebridge-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" -echo -e "Homebridge should be reachable by going to the following URL. - ${BL}http://${IP}:8581${CL} \n" diff --git a/ct/homebridge-v4.sh b/ct/homebridge-v4.sh index c1305e20..ff5edd74 100644 --- a/ct/homebridge-v4.sh +++ b/ct/homebridge-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/homepage-v4.sh b/ct/homepage-v4.sh index 95df4b44..a7713489 100644 --- a/ct/homepage-v4.sh +++ b/ct/homepage-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/hyperion-v4.sh b/ct/hyperion-v4.sh index a4746631..80f618eb 100644 --- a/ct/hyperion-v4.sh +++ b/ct/hyperion-v4.sh @@ -325,7 +325,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/influxdb-v2.sh b/ct/influxdb-v2.sh deleted file mode 100644 index 0d9e113c..00000000 --- a/ct/influxdb-v2.sh +++ /dev/null @@ -1,250 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New InfluxDB LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _____ __ _ _____ ____ - |_ _| / _| | | __ \| _ \ - | | _ __ | |_| |_ ___ _| | | | |_) | - | | | _ \| _| | | | \ \/ / | | | _ < - _| |_| | | | | | | |_| |> <| |__| | |_) | - |_____|_| |_|_| |_|\__,_/_/\_\_____/|____/ - with Telegraf -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=8 -export PCT_OPTIONS=" - -features $FEATURES - -hostname influxdb - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/influxdb-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created InfluxDB LXC to${CL} ${BL}$CTID${CL}. \n" diff --git a/ct/influxdb-v3.sh b/ct/influxdb-v3.sh deleted file mode 100644 index d4288d8b..00000000 --- a/ct/influxdb-v3.sh +++ /dev/null @@ -1,355 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="InfluxDB" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _____ __ _ _____ ____ - |_ _| / _| | | __ \| _ \ - | | _ __ | |_| |_ v3___ _| | | | |_) | - | | | _ \| _| | | | \ \/ / | | | _ < - _| |_| | | | | | | |_| |> <| |__| | |_) | - |_____|_| |_|_| |_|\__,_/_/\_\_____/|____/ - with Telegraf -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/influxdb-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" diff --git a/ct/influxdb-v4.sh b/ct/influxdb-v4.sh index 9ba3a22b..81b5457e 100644 --- a/ct/influxdb-v4.sh +++ b/ct/influxdb-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/iobroker-v3.sh b/ct/iobroker-v3.sh deleted file mode 100644 index f6a52106..00000000 --- a/ct/iobroker-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="ioBroker" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _ ____ _ - (_) | _ \ | | - _ ___ | |_) |_ __ ___ | | _____ _ __ - | |/ _ \| _ <| __/ _ \| |/ / _ \ __| - | | (_) | |_) | | | (_) | < __/ | - |_|\___/|____/|_|v3\___/|_|\_\___|_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/iobroker-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://github.com/tteck/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/iobroker-v4.sh b/ct/iobroker-v4.sh index 7e91f90f..17f878fe 100644 --- a/ct/iobroker-v4.sh +++ b/ct/iobroker-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/jellyfin-v1.sh b/ct/jellyfin-v1.sh deleted file mode 100644 index 3b8e674a..00000000 --- a/ct/jellyfin-v1.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a Jellyfin Media Server LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -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 -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/jellyfin_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for Storage Location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=ubuntu -OSVERSION=${OSTYPE}-20.04 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=8G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=jellyfin -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048\ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -lxc.cgroup2.devices.allow: c 226:0 rwm -lxc.cgroup2.devices.allow: c 226:128 rwm -lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir -lxc.mount.entry: /dev/dri/card0 dev/dri/card0 none bind,optional,create=file -lxc.mount.entry: /dev/dri/renderD128 dev/renderD128 none bind,optional,create=file -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID jellyfin_setup.sh /jellyfin_setup.sh -perms 755 -pct exec $CTID /jellyfin_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully Created Jellyfin Media Server LXC to $CTID." -echo -e "\e[1;92m Jellyfin Media Server should be reachable by going to the following URL. - http://${IP}:8096 -\e[0m" diff --git a/ct/jellyfin-v3.sh b/ct/jellyfin-v3.sh deleted file mode 100644 index 59b4cae9..00000000 --- a/ct/jellyfin-v3.sh +++ /dev/null @@ -1,370 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -CROSS="${RD}✗${CL}" -APP="Jellyfin" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${DGN} - _ _ _ __ _ - | | | | | / _(_) - | | ___| | |_v3 _| |_ _ _ __ - _ | |/ _ \ | | | | | _| | _ \ - | |__| | __/ | | |_| | | | | | | | - \____/ \___|_|_|\__, |_| |_|_| |_| - __/ | - |___/ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type ${CROSS}${YW}Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Unprivileged" - CT_TYPE="1" - echo -en "${DGN}Set CT Type ${BL}Unprivileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -PVE_CHECK -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=ubuntu -export PCT_OSVERSION=20.04 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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: c 226:0 rwm -lxc.cgroup2.devices.allow: c 226:128 rwm -lxc.cgroup2.devices.allow: c 29:0 rwm -lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file -lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir -lxc.mount.entry: /dev/dri/renderD128 dev/renderD128 none bind,optional,create=file -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/jellyfin-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" -echo -e "Jellyfin Media Server should be reachable by going to the following URL. - ${BL}http://${IP}:8096${CL}\n" diff --git a/ct/jellyfin-v4.sh b/ct/jellyfin-v4.sh index 44a18a47..37905cd7 100644 --- a/ct/jellyfin-v4.sh +++ b/ct/jellyfin-v4.sh @@ -331,7 +331,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/k0s-v4.sh b/ct/k0s-v4.sh index 1622434e..7e8ac4ba 100644 --- a/ct/k0s-v4.sh +++ b/ct/k0s-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/keycloak-v3.sh b/ct/keycloak-v3.sh deleted file mode 100644 index f11080d3..00000000 --- a/ct/keycloak-v3.sh +++ /dev/null @@ -1,360 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="Keycloak" -var_disk="4" -var_cpu="2" -var_ram="2048" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - - _ __________ _______ _ ____ _ __ - | |/ / ____\ \ / / ____| | / __ \ /\ | |/ / - | ' /| |__ \ \_/ / | | | | | | | / \ | ' / - | < | __| \ /| | v3 | | | | | |/ /\ \ | < - | . \| |____ | | | |____| |___| |__| / ____ \| . \ - |_|\_\______| |_| \_____|______\____/_/ \_\_|\_\ -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/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/keycloak-v4.sh b/ct/keycloak-v4.sh index f145d045..4702c46e 100644 --- a/ct/keycloak-v4.sh +++ b/ct/keycloak-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/magicmirror-v3.sh b/ct/magicmirror-v3.sh deleted file mode 100644 index fc2fa201..00000000 --- a/ct/magicmirror-v3.sh +++ /dev/null @@ -1,359 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="MagicMirror" -var_disk="3" -var_cpu="1" -var_ram="512" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ _____ _____ _____ __ __ _____ _____ _____ ____ _____ - | \/ | /\ / ____|_ _/ ____| \/ |_ _| __ \| __ \ / __ \| __ \ - | \ / | / \ | | __ | || | | \ / | | | | |__) | |__) | | | | |__) | - | |\/| | / /\ \| | |_ | | || | v3 | |\/| | | | | _ /| _ /| | | | _ / - | | | |/ ____ \ |__| |_| || |____| | | |_| |_| | \ \| | \ \| |__| | | \ \ - |_| |_/_/ \_\_____|_____\_____|_| |_|_____|_| \_\_| \_\ ____/|_| \_\ -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/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 28290847..ff4c7365 100644 --- a/ct/magicmirror-v4.sh +++ b/ct/magicmirror-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/mariadb-v1.sh b/ct/mariadb-v1.sh deleted file mode 100644 index c3f09991..00000000 --- a/ct/mariadb-v1.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Mariadb LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -BL=`echo "\033[36m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/mariadb_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using ${BL}${STORAGE}${CL} for Storage Location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is ${BL}${CTID}${CL}." - -echo -en "${GN} Updating LXC Template List... " -pveam update >/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Downloading LXC Template... " -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} -echo -e "${CM}${CL} \r" - -echo -en "${GN} Creating LXC Container... " -DISK_SIZE=4G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=mariadb -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 1024 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT -echo -e "${CM}${CL} \r" - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -pct push $CTID mariadb_setup.sh /mariadb_setup.sh -perms 755 -echo -e "${CM}${CL} \r" -pct exec $CTID /mariadb_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "${GN} Successfully created a MariaDB LXC Container to ${BL}${CTID}${CL}" -echo -e "${CL} Adminer should be reachable by going to the following URL. - ${BL} http://${IP}/adminer/ ${CL}" diff --git a/ct/mariadb-v2.sh b/ct/mariadb-v2.sh deleted file mode 100644 index 233296d4..00000000 --- a/ct/mariadb-v2.sh +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Mariadb LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ _ _ _ - | \/ | (_) | | | - | \ / | __ _ _ __ _ __ _ __| | |__ - | |\/| |/ _ | __| |/ _ |/ _ | _ \ - | | | | (_| | | | | (_| | (_| | |_) | - |_| |_|\__,_|_| |_|\__,_|\__,_|_.__/ - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname mariadb - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/mariadb-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Mariadb LXC to${CL} ${BL}$CTID${CL}. -${BL}Adminer${CL} should be reachable by going to the following URL. - ${BL}http://${IP}/adminer/${CL} \n" diff --git a/ct/mariadb-v3.sh b/ct/mariadb-v3.sh deleted file mode 100644 index 74c52575..00000000 --- a/ct/mariadb-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="MariaDB" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ _ _ _ - | \/ | (_) | | | - | \ / | __ _ _ __ _ __ _ __| | |__ - | |\/| |/ _ | __| |/ _ |/ _ | _ \ - | | | | (_| | | | | (_| | (_| | |_) | - |_| |_|\__,_|_|v3|_|\__,_|\__,_|_.__/ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/mariadb-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://github.com/tteck/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/mariadb-v4.sh b/ct/mariadb-v4.sh index 780ba45c..20a1ff7a 100644 --- a/ct/mariadb-v4.sh +++ b/ct/mariadb-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/meshcentral-v2.sh b/ct/meshcentral-v2.sh deleted file mode 100644 index f8df0b17..00000000 --- a/ct/meshcentral-v2.sh +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="MeshCentral" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ _ _____ _ _ - | \/ | | | / ____| | | | | - | \ / | ___ ___| |__ | | ___ _ __ | |_ _ __ __ _| | - | |\/| |/ _ \/ __| _ \| | / _ \ _ \| __| __/ _ | | - | | | | __/\__ \ | | | |___| __/ | | | |_| | | (_| | | - |_| |_|\___||___/_| |_|\_____\___|_| |_|\__|_| \__,_|_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some applications may not work properly due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${APP} should be reachable by going to the following URL. - ${BL}http://${IP}${CL} \n" diff --git a/ct/meshcentral-v3.sh b/ct/meshcentral-v3.sh deleted file mode 100644 index ff411439..00000000 --- a/ct/meshcentral-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="MeshCentral" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ _ _____ _ _ - | \/ | | | / ____| | | | | - | \ / | ___ ___| |__ | | ___ _ __ | |_ _ __ __ _| | - | |\/| |/ _ \/ __| _ \| | v3 / _ \ _ \| __| __/ _ | | - | | | | __/\__ \ | | | |___| __/ | | | |_| | | (_| | | - |_| |_|\___||___/_| |_|\_____\___|_| |_|\__|_| \__,_|_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/meshcentral-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://github.com/tteck/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/meshcentral-v4.sh b/ct/meshcentral-v4.sh index f91f91d3..8de241a6 100644 --- a/ct/meshcentral-v4.sh +++ b/ct/meshcentral-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/motioneye-v1.sh b/ct/motioneye-v1.sh deleted file mode 100644 index 944ee9b6..00000000 --- a/ct/motioneye-v1.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New MotionEye NVR LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/motioneye_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null - -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=8G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=motioneye -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048\ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID motioneye_setup.sh /motioneye_setup.sh -perms 755 -pct exec $CTID /motioneye_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully Created MotionEye LXC to $CTID." -echo -e "\e[1;92m MotionEye NVR should be reachable by going to the following URL. - http://${IP}:8765 -\e[0m" diff --git a/ct/motioneye-v2.sh b/ct/motioneye-v2.sh deleted file mode 100644 index 0c3449b3..00000000 --- a/ct/motioneye-v2.sh +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="Motioneye" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ ____ _______ _____ ____ _ _ ________ ________ - | \/ |/ __ \__ __|_ _/ __ \| \ | | ____\ \ / / ____| - | \ / | | | | | | | || | | | \| | |__ \ \_/ /| |__ - | |\/| | | | | | | | || | | | | __| \ / | __| - | | | | |__| | | | _| || |__| | |\ | |____ | | | |____ - |_| |_|\____/ |_| |_____\____/|_| \_|______| |_| |______| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=8 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:8765${CL} \n" diff --git a/ct/motioneye-v3.sh b/ct/motioneye-v3.sh deleted file mode 100644 index 1c3ca29e..00000000 --- a/ct/motioneye-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Motioneye" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ ____ _______ _____ ____ _ _ ________ ________ - | \/ |/ __ \__ __|_ _/ __ \| \ | | ____\ \ / / ____| - | \ / | | | | | | | || | | | \| | |__ \ \_/ /| |__ - | |\/| | | | | | | | || | | | | __| \ / | __| - | | | | |__| | | | v3_| || |__| | |\ | |____ | | | |____ - |_| |_|\____/ |_| |_____\____/|_| \_|______| |_| |______| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/motioneye-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://github.com/tteck/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/motioneye-v4.sh b/ct/motioneye-v4.sh index 78d60c7b..f8a8663b 100644 --- a/ct/motioneye-v4.sh +++ b/ct/motioneye-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/mqtt-v1.sh b/ct/mqtt-v1.sh deleted file mode 100644 index bda6ed8e..00000000 --- a/ct/mqtt-v1.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New MQTT LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/mqtt_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null - -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=2G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=mqtt -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 512 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID mqtt_setup.sh /mqtt_setup.sh -perms 755 -pct exec $CTID /mqtt_setup.sh -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created a MQTT LXC Container to $CTID at IP Address ${IP}" diff --git a/ct/mqtt-v2.sh b/ct/mqtt-v2.sh deleted file mode 100644 index 7bd70ed0..00000000 --- a/ct/mqtt-v2.sh +++ /dev/null @@ -1,250 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New MQTT LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ ____ _______ _______ - | \/ |/ __ \__ __|__ __| - | \ / | | | | | | | | - | |\/| | | | | | | | | - | | | | |__| | | | | | - |_| |_|\___\_\ |_| |_| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname mqtt - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/mqtt-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created MQTT LXC to${CL} ${BL}$CTID${CL}. \n" diff --git a/ct/mqtt-v3.sh b/ct/mqtt-v3.sh deleted file mode 100644 index 7d74a950..00000000 --- a/ct/mqtt-v3.sh +++ /dev/null @@ -1,354 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="MQTT" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ ____ _______ _______ - | \/ |/ __ \__ __|__ __| - | \ / | | | | | | | | - | |\/| | | | | | | | | - | | | | |__| | | | | | - |_| |_|\___\_\ |_| v3 |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/mqtt-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" diff --git a/ct/mqtt-v4.sh b/ct/mqtt-v4.sh index 84801204..0518991c 100644 --- a/ct/mqtt-v4.sh +++ b/ct/mqtt-v4.sh @@ -285,7 +285,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/n8n-v3.sh b/ct/n8n-v3.sh deleted file mode 100644 index 1347f25c..00000000 --- a/ct/n8n-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="n8n" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - ___ - / _ \ - _ __ | (_) |_v3_ - | _ \ > _ <| _ \ - | | | | (_) | | | | - |_| |_|\___/|_| |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}3${CL}${DGN}GB${CL}" - DISK_SIZE="3" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 3 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="3"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/n8n-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://github.com/tteck/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/n8n-v4.sh b/ct/n8n-v4.sh index c7b0cc56..f09ea205 100644 --- a/ct/n8n-v4.sh +++ b/ct/n8n-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/navidrome-v4.sh b/ct/navidrome-v4.sh index 750767a0..ed513d68 100644 --- a/ct/navidrome-v4.sh +++ b/ct/navidrome-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/nextcloudpi-v4.sh b/ct/nextcloudpi-v4.sh index 0b119e71..84ed147c 100644 --- a/ct/nextcloudpi-v4.sh +++ b/ct/nextcloudpi-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/nginx-proxy-manager-v1.sh b/ct/nginx-proxy-manager-v1.sh deleted file mode 100644 index efc67e28..00000000 --- a/ct/nginx-proxy-manager-v1.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env bash - -#!/usr/bin/env bash -while true; do - read -p "This will create a New Nginx Proxy Manager LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/npm_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "LXC ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC... \e[0m" -DISK_SIZE=3G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=npm -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 1024 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC... \e[0m" -pct start $CTID -pct push $CTID npm_setup.sh /npm_setup.sh -perms 755 -pct exec $CTID /npm_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully Created Nginx Proxy Manager LXC to $CTID." -echo -e "\e[1;92m Nginx Proxy Manager should be reachable by going to the following URL. - http://${IP}:81 -\e[0m" diff --git a/ct/nginx-proxy-manager-v2.sh b/ct/nginx-proxy-manager-v2.sh deleted file mode 100644 index 2b147d60..00000000 --- a/ct/nginx-proxy-manager-v2.sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Nginx Proxy Manager LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _ _ _____ __ __ - | \ | | __ \| \/ | - | \| | |__) | \ / | - | | ___/| |\/| | - | |\ | | | | | | - |_| \_|_| |_| |_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=3 -export PCT_OPTIONS=" - -features $FEATURES - -hostname npm - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd 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}') - -echo -e "${GN}Successfully created Nginx Proxy Manager LXC to${CL} ${BL}$CTID${CL}. -Nginx Proxy Manager should be reachable by going to the following URL. - ${BL}http://${IP}:81${CL} \n" diff --git a/ct/nginx-proxy-manager-v3.sh b/ct/nginx-proxy-manager-v3.sh deleted file mode 100644 index bfcf2225..00000000 --- a/ct/nginx-proxy-manager-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Nginx Proxy Manager" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _ _ _____ __ __ - | \ | | __ \| \/ | - | \| | |__) | \ / | - | | ___/| |\/| | - | |\ | | | | | | - |_| \_|_| v3 |_| |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}3${CL}${DGN}GB${CL}" - DISK_SIZE="3" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 3 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="3"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/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://github.com/tteck/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/nginx-proxy-manager-v4.sh b/ct/nginx-proxy-manager-v4.sh index c12d14d1..6cc5cb1b 100644 --- a/ct/nginx-proxy-manager-v4.sh +++ b/ct/nginx-proxy-manager-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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/nginx-proxy-manager-install.sh)" || exit +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/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/ diff --git a/ct/nocodb-v2.sh b/ct/nocodb-v2.sh deleted file mode 100644 index 4eafd1cf..00000000 --- a/ct/nocodb-v2.sh +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="NocoDB" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _ _____ ____ - | \ | | | __ \| _ \ - | \| | ___ ___ ___ | | | | |_) | - | |/ _ \ / __/ _ \| | | | _ < - | |\ | (_) | (_| (_) | |__| | |_) | - |_| \_|\___/ \___\___/|_____/|____/ -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some applications may not work properly due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:8080/dashboard${CL}\n" diff --git a/ct/nocodb-v3.sh b/ct/nocodb-v3.sh deleted file mode 100644 index 9ede88a8..00000000 --- a/ct/nocodb-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="NocoDB" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _ _____ ____ - | \ | | | __ \| _ \ - | \| | ___ v3___ ___ | | | | |_) | - | |/ _ \ / __/ _ \| | | | _ < - | |\ | (_) | (_| (_) | |__| | |_) | - |_| \_|\___/ \___\___/|_____/|____/ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/nocodb-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://github.com/tteck/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/nocodb-v4.sh b/ct/nocodb-v4.sh index 2ca00f97..7503fb7a 100644 --- a/ct/nocodb-v4.sh +++ b/ct/nocodb-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/node-red-v1.sh b/ct/node-red-v1.sh deleted file mode 100644 index ebd544b3..00000000 --- a/ct/node-red-v1.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Node-Red LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/node-red_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=4G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=nodered -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 1024 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID node-red_setup.sh /node-red_setup.sh -perms 755 -pct exec $CTID /node-red_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully Created Node-Red LXC to $CTID." -echo -e "\e[1;92m Node-Red should be reachable by going to the following URL. - http://${IP}:1880 -\e[0m" diff --git a/ct/node-red-v2.sh b/ct/node-red-v2.sh deleted file mode 100644 index 9ecc7d17..00000000 --- a/ct/node-red-v2.sh +++ /dev/null @@ -1,253 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Node-Red LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _ _ _ _____ _ - | \ | | | | | __ \ | | - | \| | ___ __| | ___ ______| |__) |___ __| | - | |/ _ \ / _ |/ _ \______| _ // _ \/ _ | - | |\ | (_) | (_| | __/ | | \ \ __/ (_| | - |_| \_|\___/ \__,_|\___| |_| \_\___|\__,_| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname node-red - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/node-red-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Node-Red LXC to${CL} ${BL}$CTID${CL}. -${RD}Node-Red${CL} should be reachable by going to the following URL. - - ${BL}http://${IP}:1880${CL} \n" diff --git a/ct/node-red-v3.sh b/ct/node-red-v3.sh deleted file mode 100644 index 58252e17..00000000 --- a/ct/node-red-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Node Red" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _ _ _ _____ _ - | \ | | | | | __ \ | | - | \| | ___ __| | ___ ______| |__) |___ __| | - | |/ _ \ / _ |/ _ \__v3__| _ // _ \/ _ | - | |\ | (_) | (_| | __/ | | \ \ __/ (_| | - |_| \_|\___/ \__,_|\___| |_| \_\___|\__,_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/node-red-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://github.com/tteck/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/node-red-v4.sh b/ct/node-red-v4.sh index 97a94755..2ca913de 100644 --- a/ct/node-red-v4.sh +++ b/ct/node-red-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/omada-v2.sh b/ct/omada-v2.sh deleted file mode 100644 index 6ec8036b..00000000 --- a/ct/omada-v2.sh +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/env bash -clear -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Omada Controller LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - ____ _ _____ _ _ _ - / __ \ | | / ____| | | | | | - | | | |_ __ ___ __ _ __| | __ _ | | ___ _ __ | |_ _ __ ___ | | | ___ _ __ - | | | | _ _ \ / _ |/ _ |/ _ | | | / _ \| _ \| __| __/ _ \| | |/ _ \ __| - | |__| | | | | | | (_| | (_| | (_| | | |___| (_) | | | | |_| | | (_) | | | __/ | - \____/|_| |_| |_|\__,_|\__,_|\__,_| \_____\___/|_| |_|\__|_| \___/|_|_|\___|_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose an Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=ubuntu -export PCT_OSVERSION=20.04 -export PCT_DISK_SIZE=8 -export PCT_OPTIONS=" - -features $FEATURES - -hostname omada - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/omada-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Omada Controller LXC to${CL} ${BL}$CTID${CL}. -${BL}Omada${CL} should be reachable by going to the following URL. - ${BL}https://${IP}:8043${CL} \n" diff --git a/ct/omada-v3.sh b/ct/omada-v3.sh deleted file mode 100644 index 7b97dace..00000000 --- a/ct/omada-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Omada" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - ____ _ _____ _ _ _ - / __ \ | | / ____| | | | | | - | | | |_ __ ___ v3__ _ __| | __ _ | | ___ _ __ | |_ _ __ ___ | | | ___ _ __ - | | | | _ _ \ / _ |/ _ |/ _ | | | / _ \| _ \| __| __/ _ \| | |/ _ \ __| - | |__| | | | | | | (_| | (_| | (_| | | |___| (_) | | | | |_| | | (_) | | | __/ | - \____/|_| |_| |_|\__,_|\__,_|\__,_| \_____\___/|_| |_|\__|_| \___/|_|_|\___|_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=ubuntu -export PCT_OSVERSION=20.04 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/omada-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://github.com/tteck/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/omada-v4.sh b/ct/omada-v4.sh index 099deba7..2b48b2a4 100644 --- a/ct/omada-v4.sh +++ b/ct/omada-v4.sh @@ -318,7 +318,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/omv-v4.sh b/ct/omv-v4.sh index a649a28c..9aa13239 100644 --- a/ct/omv-v4.sh +++ b/ct/omv-v4.sh @@ -320,7 +320,7 @@ 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/openhab-v3.sh b/ct/openhab-v3.sh deleted file mode 100644 index a4726cb0..00000000 --- a/ct/openhab-v3.sh +++ /dev/null @@ -1,361 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="openHAB" -var_disk="8" -var_cpu="2" -var_ram="2048" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _ ____ - | | | | /\ | _ \ - ___ _ __ ___ _ __ | |__| | / \ | |_) | - / _ \| _ \ / _ \ _ \| __ | / /\ \ | _ < - | (_) | |_) | __/ | | | | | |/ ____ \| |_) | - \___/| .__/ \___|_| |_|_| |_/_/ v3 \_\____/ - | | - |_| -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Unprivileged" - CT_TYPE="1" - echo -en "${DGN}Set CT Type ${BL}Unprivileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/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/openhab-v4.sh b/ct/openhab-v4.sh index dc559dc3..75d60950 100644 --- a/ct/openhab-v4.sh +++ b/ct/openhab-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/paperless-ngx-v4.sh b/ct/paperless-ngx-v4.sh index 37c347a7..b51119b6 100644 --- a/ct/paperless-ngx-v4.sh +++ b/ct/paperless-ngx-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/photoprism-v2.sh b/ct/photoprism-v2.sh deleted file mode 100644 index 31035d89..00000000 --- a/ct/photoprism-v2.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -PP=`echo "\e[1;35m"` -APP="PhotoPrism" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${PP} - _____ _ _ _____ _ - | __ \| | | | | __ \ (_) - | |__) | |__ ___ | |_ ___ | |__) | __ _ ___ _ __ ___ - | ___/| _ \ / _ \| __/ _ \| ___/ __| / __| _ _ \ - | | | | | | (_) | || (_) | | | | | \__ \ | | | | | - |_| |_| |_|\___/ \__\___/|_| |_| |_|___/_| |_| |_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=8 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:2342${CL} \n" diff --git a/ct/photoprism-v3.sh b/ct/photoprism-v3.sh deleted file mode 100644 index 3f90236f..00000000 --- a/ct/photoprism-v3.sh +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -PP=`echo "\e[1;35m"` -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="PhotoPrism" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${PP} - _____ _ _ _____ _ - | __ \| | | | | __ \ (_) - | |__) | |__ ___ | |_ ___ | |__) | __ _ ___ _ __ ___ - | ___/| _ \ / _ \| __/ _ \| ___/ __| / __| _ _ \ - | | | | | | (_) | || (_) | | | | | \__ \ | | | | | - |_| v3 |_| |_|\___/ \__\___/|_| |_| |_|___/_| |_| |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/photoprism-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://github.com/tteck/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/photoprism-v4.sh b/ct/photoprism-v4.sh index 5f4a5827..fc5b8c7f 100644 --- a/ct/photoprism-v4.sh +++ b/ct/photoprism-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/pihole-v1.sh b/ct/pihole-v1.sh deleted file mode 100644 index 1d420089..00000000 --- a/ct/pihole-v1.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Pi-hole LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/pihole_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "LXC ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null - -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC... \e[0m" -DISK_SIZE=2G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=pi-hole -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 512 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC... \e[0m" -pct start $CTID -pct push $CTID pihole_setup.sh /pihole_setup.sh -perms 755 -pct exec $CTID /pihole_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created a Pi-hole LXC to $CTID" -echo -e "\e[1;92m Pi-hole should be reachable by going to the following URL. - http://${IP} -\e[0m" diff --git a/ct/pihole-v2.sh b/ct/pihole-v2.sh deleted file mode 100644 index 9a0abcdd..00000000 --- a/ct/pihole-v2.sh +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="Pihole" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _____ _____ _ _ ____ _ ______ - | __ \_ _| | | |/ __ \| | | ____| - | |__) || | | |__| | | | | | | |__ - | ___/ | | | __ | | | | | | __| - | | _| |_| | | | |__| | |____| |____ - |_| |_____|_| |_|\____/|______|______| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}${CL} \n" diff --git a/ct/pihole-v3.sh b/ct/pihole-v3.sh deleted file mode 100644 index 03a5b577..00000000 --- a/ct/pihole-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Pihole" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _____ _____ _ _ ____ _ ______ - | __ \_ _| | | |/ __ \| | | ____| - | |__) || | | |__| | | | | | | |__ - | ___/ | | | __ | | | | | | __| - | | v3 _| |_| | | | |__| | |____| |____ - |_| |_____|_| |_|\____/|______|______| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Unprivileged" - CT_TYPE="1" - echo -en "${DGN}Set CT Type ${BL}Unprivileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/pihole-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" -echo -e "${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}/admin${CL} \n" diff --git a/ct/pihole-v4.sh b/ct/pihole-v4.sh index 01d25fff..e6a8b6d8 100644 --- a/ct/pihole-v4.sh +++ b/ct/pihole-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/plex-v1.sh b/ct/plex-v1.sh deleted file mode 100644 index 68949613..00000000 --- a/ct/plex-v1.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Plex Media Server LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -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 -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/plex_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for Storage Location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=ubuntu -OSVERSION=${OSTYPE}-20.04 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=8G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=plex -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048\ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: c 226:0 rwm -lxc.cgroup2.devices.allow: c 226:128 rwm -lxc.cgroup2.devices.allow: c 29:0 rwm -lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file -lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir -lxc.mount.entry: /dev/dri/renderD128 dev/renderD128 none bind,optional,create=file -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID plex_setup.sh /plex_setup.sh -perms 755 -pct exec $CTID /plex_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully Created Plex Media Server LXC to $CTID." -echo -e "\e[1;92m Plex Media Server should be reachable by going to the following URL. - http://${IP}:32400/web -\e[0m" diff --git a/ct/plex-v3.sh b/ct/plex-v3.sh deleted file mode 100644 index da77b58e..00000000 --- a/ct/plex-v3.sh +++ /dev/null @@ -1,368 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -CROSS="${RD}✗${CL}" -APP="Plex" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _____ _ - | __ \| | - | |__) | | _____ __ - | ___/| |/ _ \ \/ / - | | | | __/> < - |_| v3 |_|\___/_/\_\ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type ${CROSS}${YW}Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Unprivileged" - CT_TYPE="1" - echo -en "${DGN}Set CT Type ${BL}Unprivileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -PVE_CHECK -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=ubuntu -export PCT_OSVERSION=20.04 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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: c 226:0 rwm -lxc.cgroup2.devices.allow: c 226:128 rwm -lxc.cgroup2.devices.allow: c 29:0 rwm -lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file -lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir -lxc.mount.entry: /dev/dri/renderD128 dev/renderD128 none bind,optional,create=file -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/plex-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" -echo -e "Plex Media Server should be reachable by going to the following URL. - ${BL}http://${IP}:32400/web${CL}\n" diff --git a/ct/plex-v4.sh b/ct/plex-v4.sh index a490c938..6566426f 100644 --- a/ct/plex-v4.sh +++ b/ct/plex-v4.sh @@ -331,7 +331,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/podman-homeassistant-v1.sh b/ct/podman-homeassistant-v1.sh deleted file mode 100644 index 7bf3164a..00000000 --- a/ct/podman-homeassistant-v1.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Podman Home Assistant Container LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _____ _ - | __ \ | | - | |__) |__ __| |_ __ ___ __ _ _ __ - | ___/ _ \ / _ | _ _ \ / _ | _ \ - | | | (_) | (_| | | | | | | (_| | | | | - |_| \___/ \__,_|_| |_| |_|\__,_|_| |_| _ _ _ - | | (_) | | | | - | |__ ___ _ __ ___ ___ __ _ ___ ___ _ ___| |_ __ _ _ __ | |_ - | _ \ / _ \| _ _ \ / _ \/ _ / __/ __| / __| __/ _ | _ \| __| - | | | | (_) | | | | | | __/ (_| \__ \__ \ \__ \ || (_| | | | | |_ - |_| |_|\___/|_| |_| |_|\___|\__,_|___/___/_|___/\__\__,_|_| |_|\__| - -${CL}" -} -header_info -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 -trap cleanup EXIT -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/podman_ha_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using ${BL}$STORAGE${CL} for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is ${BL}$CTID${CL}" -echo -en "${GN} Updating LXC Template List... " -pveam update >/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Downloading LXC Template... " -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} -echo -e "${CM}${CL} \r" - -echo -en "${GN} Creating LXC Container... " -DISK_SIZE=16G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi - ARCH=$(dpkg --print-architecture) -HOSTNAME=p-homeassistant -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT -echo -e "${CM}${CL} \r" -echo -en "${GN} Starting LXC Container... " -pct start $CTID -pct push $CTID podman_ha_setup.sh /podman_ha_setup.sh -perms 755 -echo -e "${CM}${CL} \r" -pct exec $CTID /podman_ha_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully Created Podman Home Assistant Container LXC to ${BL}$CTID${CL}." -echo -e "${CL} Home Assistant Container should be reachable by going to the following URL. - ${BL}http://${IP}:8123${CL} -Yacht should be reachable by going to the following URL. - ${BL}http://${IP}:8000${CL} \n" diff --git a/ct/podman-homeassistant-v3.sh b/ct/podman-homeassistant-v3.sh deleted file mode 100644 index 30985849..00000000 --- a/ct/podman-homeassistant-v3.sh +++ /dev/null @@ -1,371 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -CROSS="${RD}✗${CL}" -APP="P-Home Assistant" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _____ _ - | __ \ | | - | |__) |__ __| |_ __ ___ __ _ _ __ - | ___/ _ \ / _ | _ _ \ / _ | _ \ - | | | (_) | (_| | | | | | | (_| | | | | - |_| \___/ \__,_|_| |_| |_|\__,_|_| |_| _ _ _ - | | v3 (_) | | | | - | |__ ___ _ __ ___ ___ __ _ ___ ___ _ ___| |_ __ _ _ __ | |_ - | _ \ / _ \| _ _ \ / _ \/ _ / __/ __| / __| __/ _ | _ \| __| - | | | | (_) | | | | | | __/ (_| \__ \__ \ \__ \ || (_| | | | | |_ - |_| |_|\___/|_| |_| |_|\___|\__,_|___/___/_|___/\__\__,_|_| |_|\__| - -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}16${CL}${DGN}GB${CL}" - DISK_SIZE="16" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type ${CROSS}${YW}Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Unprivileged" - CT_TYPE="1" - echo -en "${DGN}Set CT Type ${BL}UnPrivileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 16 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="16"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} -PVE_CHECK -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/podman-homeassistant-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" -echo -e "${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:8123${CL} -Yacht should be reachable by going to the following URL. - ${BL}http://${IP}:8000${CL}\n" diff --git a/ct/podman-homeassistant-v4.sh b/ct/podman-homeassistant-v4.sh index e4d22054..9aaa9f40 100644 --- a/ct/podman-homeassistant-v4.sh +++ b/ct/podman-homeassistant-v4.sh @@ -333,7 +333,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/podman-v4.sh b/ct/podman-v4.sh index 97250e37..49878c07 100644 --- a/ct/podman-v4.sh +++ b/ct/podman-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/postgresql-v3.sh b/ct/postgresql-v3.sh deleted file mode 100644 index d68d8102..00000000 --- a/ct/postgresql-v3.sh +++ /dev/null @@ -1,361 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="PostgreSQL" -var_disk="4" -var_cpu="1" -var_ram="1024" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _____ _ _____ ____ _ - | __ \ | | / ____|/ __ \| | - | |__) |__ ___| |_ __ _ _ __ ___| (___ | | | | | - | ___/ _ \/ __| __/ _ | __/ _ \\___ \| | | | | - | | | (_) \__ \ || (_| | | | __/____) | |__| | |____ - |_| \___/|___/\__\__, |_| \___|_____/ \___\_\______| - __/ | - v3|___/ -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/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/postgresql-v4.sh b/ct/postgresql-v4.sh index aaa68b00..cee3ec14 100644 --- a/ct/postgresql-v4.sh +++ b/ct/postgresql-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/prometheus-v3.sh b/ct/prometheus-v3.sh deleted file mode 100644 index a41f5125..00000000 --- a/ct/prometheus-v3.sh +++ /dev/null @@ -1,359 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="Prometheus" -var_disk="4" -var_cpu="1" -var_ram="2048" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _____ _____ ____ __ __ ______ _______ _ _ ______ _ _ _____ - | __ \| __ \ / __ \| \/ | ____|__ __| | | | ____| | | |/ ____| - | |__) | |__) | | | | \ / | |__ | | | |__| | |__ | | | | (___ - | ___/| _ /| | | | |\/| | __| v3 | | | __ | __| | | | |\___ \ - | | | | \ \| |__| | | | | |____ | | | | | | |____| |__| |____) | - |_| |_| \_\\_____/|_| |_|______| |_| |_| |_|______|\____/|_____/ -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/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/prometheus-v4.sh b/ct/prometheus-v4.sh index 6bb1b9db..3cc52e25 100644 --- a/ct/prometheus-v4.sh +++ b/ct/prometheus-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/scrypted-v4.sh b/ct/scrypted-v4.sh index 94f598d1..77f84839 100644 --- a/ct/scrypted-v4.sh +++ b/ct/scrypted-v4.sh @@ -324,7 +324,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/shinobi-v4.sh b/ct/shinobi-v4.sh index cfb70935..08b8fcb9 100644 --- a/ct/shinobi-v4.sh +++ b/ct/shinobi-v4.sh @@ -319,7 +319,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/syncthing-v4.sh b/ct/syncthing-v4.sh index 6a5e0de7..85da6fc5 100644 --- a/ct/syncthing-v4.sh +++ b/ct/syncthing-v4.sh @@ -311,7 +311,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/technitiumdns-v2.sh b/ct/technitiumdns-v2.sh deleted file mode 100644 index 2d960480..00000000 --- a/ct/technitiumdns-v2.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="Technitium DNS" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - - _______ _ _ _ _ - |__ __| | | (_) | (_) - | | ___ ___| |__ _ __ _| |_ _ _ _ _ __ ___ - | |/ _ \/ __| _ \| _ \| | __| | | | | _ _ \ - | | __/ (__| | | | | | | | |_| | |_| | | | | | | - |_|\___|\___|_| |_|_| |_|_|\__|_|\__,_|_| |_| |_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:5380${CL} \n" diff --git a/ct/technitiumdns-v3.sh b/ct/technitiumdns-v3.sh deleted file mode 100644 index 201b6267..00000000 --- a/ct/technitiumdns-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Technitium DNS" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - _______ _ _ _ _ - |__ __| | | (_) | (_) - | | ___v3___| |__ _ __ _| |_ _ _ _ _ __ ___ - | |/ _ \/ __| _ \| _ \| | __| | | | | _ _ \ - | | __/ (__| | | | | | | | |_| | |_| | | | | | | - |_|\___|\___|_| |_|_| |_|_|\__|_|\__,_|_| |_| |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/technitiumdns-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://github.com/tteck/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/technitiumdns-v4.sh b/ct/technitiumdns-v4.sh index 644ddd78..70716601 100644 --- a/ct/technitiumdns-v4.sh +++ b/ct/technitiumdns-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/trilium-v4.sh b/ct/trilium-v4.sh index dbdf6585..4342cf70 100644 --- a/ct/trilium-v4.sh +++ b/ct/trilium-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/ubuntu-v1.sh b/ct/ubuntu-v1.sh deleted file mode 100644 index 3703d85a..00000000 --- a/ct/ubuntu-v1.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Ubuntu 21.10 LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/ubuntu_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=ubuntu -OSVERSION=${OSTYPE}-21.10 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC... \e[0m" -DISK_SIZE=2G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=$OSTYPE -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 1 -memory 512\ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC... \e[0m" -pct start $CTID -pct push $CTID ubuntu_setup.sh /ubuntu_setup.sh -perms 755 -pct exec $CTID /ubuntu_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created a Ubuntu LXC Container to $CTID at IP Address ${IP}" diff --git a/ct/ubuntu-v2.sh b/ct/ubuntu-v2.sh deleted file mode 100644 index 4152e1d0..00000000 --- a/ct/ubuntu-v2.sh +++ /dev/null @@ -1,255 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Ubuntu 21.10 LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _ _ _ - | | | | | | | - | | | | |__ _ _ _ __ | |_ _ _ - | | | | _ \| | | | _ \| __| | | | - | |__| | |_) | |_| | | | | |_| |_| | - \____/|_.__/ \__,_|_| |_|\__|\__,_| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=ubuntu -export PCT_OSVERSION=21.10 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname ubuntu - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/ubuntu-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Ubuntu 21.10 LXC to${CL} ${BL}$CTID${CL}. \n" diff --git a/ct/ubuntu-v3.sh b/ct/ubuntu-v3.sh deleted file mode 100644 index 5f5b38b1..00000000 --- a/ct/ubuntu-v3.sh +++ /dev/null @@ -1,377 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Ubuntu" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _ _ _ _ - | | | | | | | - | | | | |__ _ v3_ _ __ | |_ _ _ - | | | | _ \| | | | _ \| __| | | | - | |__| | |_) | |_| | | | | |_| |_| | - \____/|_.__/ \__,_|_| |_|\__|\__,_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using Version ${BGN}22.04${CL}" - VER="22.04" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type 18.04, 20.04, 21.10 or Press [ENTER] for Default: 22.04" - read VER - if [ -z $VER ]; then VER="22.04"; fi; - echo -en "${DGN}Set Version To ${BL}$VER${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using Version ${BGN}$VER${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=ubuntu -export PCT_OSVERSION=$VER -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/ubuntu-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" diff --git a/ct/ubuntu-v4.sh b/ct/ubuntu-v4.sh index 44f3d233..755af1cd 100644 --- a/ct/ubuntu-v4.sh +++ b/ct/ubuntu-v4.sh @@ -318,7 +318,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/umbrel-v4.sh b/ct/umbrel-v4.sh index c19dce93..859696e8 100644 --- a/ct/umbrel-v4.sh +++ b/ct/umbrel-v4.sh @@ -325,7 +325,7 @@ 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/unifi-v2.sh b/ct/unifi-v2.sh deleted file mode 100644 index 077f3cc1..00000000 --- a/ct/unifi-v2.sh +++ /dev/null @@ -1,258 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="UniFi" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _ _ _ ______ _ - | | | | (_) ____(_) - | | | |_ __ _| |__ _ - | | | | _ \| | __| | | - | |__| | | | | | | | | - \____/|_| |_|_|_| |_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=8 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 2048 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}https://${IP}:8443${CL} \n" diff --git a/ct/unifi-v3.sh b/ct/unifi-v3.sh deleted file mode 100644 index 158758b1..00000000 --- a/ct/unifi-v3.sh +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Unifi" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - _ _ _ ______ _ - | | | | (_) ____(_) - | | | |_ __ _| |__ _ - | | | | _ \| | __| | | - | |__| | | | | | | | | - \____/|_| |_|_|_| v3 |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}8${CL}${DGN}GB${CL}" - DISK_SIZE="8" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 8 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="8"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/unifi-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://github.com/tteck/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/unifi-v4.sh b/ct/unifi-v4.sh index 3d60590d..b0a9bfd4 100644 --- a/ct/unifi-v4.sh +++ b/ct/unifi-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/uptimekuma-v2.sh b/ct/uptimekuma-v2.sh deleted file mode 100644 index b40519ba..00000000 --- a/ct/uptimekuma-v2.sh +++ /dev/null @@ -1,261 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -DGN=`echo "\033[32m"` -CL=`echo "\033[m"` -APP="Uptime Kuma" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${DGN} - _ _ _ _ _ __ - | | | | | | (_) | |/ / - | | | |_ __ | |_ _ _ __ ___ ___ | ' /_ _ _ __ ___ __ _ - | | | | _ \| __| | _ _ \ / _ \ | <| | | | _ _ \ / _ | - | |__| | |_) | |_| | | | | | | __/ | . \ |_| | | | | | | (_| | - \____/| .__/ \__|_|_| |_| |_|\___| |_|\_\__,_|_| |_| |_|\__,_| - | | - |_| -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some applications may not work properly due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:3001${CL}\n" diff --git a/ct/uptimekuma-v3.sh b/ct/uptimekuma-v3.sh deleted file mode 100644 index d9cb376b..00000000 --- a/ct/uptimekuma-v3.sh +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Uptime Kuma" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${DGN} - _ _ _ _ _ __ - | | | | | | (_) | |/ / - | | | |_v3_ | |_ _ _ __ ___ ___ | ' /_ _ _ __ ___ __ _ - | | | | _ \| __| | _ _ \ / _ \ | <| | | | _ _ \ / _ | - | |__| | |_) | |_| | | | | | | __/ | . \ |_| | | | | | | (_| | - \____/| .__/ \__|_|_| |_| |_|\___| |_|\_\__,_|_| |_| |_|\__,_| - | | - |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/uptimekuma-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://github.com/tteck/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/uptimekuma-v4.sh b/ct/uptimekuma-v4.sh index b31b279f..297aae54 100644 --- a/ct/uptimekuma-v4.sh +++ b/ct/uptimekuma-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/vaultwarden-v1.sh b/ct/vaultwarden-v1.sh deleted file mode 100644 index 56b5ac3b..00000000 --- a/ct/vaultwarden-v1.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env bash -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RD=`echo "\033[01;31m"` -BL=`echo "\033[36m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Vaultwarden LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - __ __ _ _ _ - \ \ / / | | | | | - \ \ / /_ _ _ _| | |___ ____ _ _ __ __| | ___ _ __ - \ \/ / _ | | | | | __\ \ /\ / / _ | __/ _ |/ _ \ _ \ - \ / (_| | |_| | | |_ \ V V / (_| | | | (_| | __/ | | | - \/ \__,_|\__,_|_|\__| \_/\_/ \__,_|_| \__,_|\___|_| |_| - -${CL}" -} - -header_info -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/vault_setup.sh - -load_module overlay -echo -e "${RD} Expect 30+ minute install time. ${CL} \n" -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null - -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=8G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=vaultwarden -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 4 -memory 4096\ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID vault_setup.sh /vault_setup.sh -perms 755 -pct exec $CTID /vault_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created a Vaultwarden LXC Container to $CTID" -echo -e "\e[1;92m Vaultwarden should be reachable by going to the following URL. - http://${IP}:8000 -\e[0m" diff --git a/ct/vaultwarden-v2.sh b/ct/vaultwarden-v2.sh deleted file mode 100644 index fe16570c..00000000 --- a/ct/vaultwarden-v2.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="Vaultwarden" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - __ __ _ _ _ - \ \ / / | | | | | - \ \ / /_ _ _ _| | |___ ____ _ _ __ __| | ___ _ __ - \ \/ / _ | | | | | __\ \ /\ / / _ | __/ _ |/ _ \ _ \ - \ / (_| | |_| | | |_ \ V V / (_| | | | (_| | __/ | | | - \/ \__,_|\__,_|_|\__| \_/\_/ \__,_|_| \__,_|\___|_| |_| - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=8 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 4 - -memory 4096 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:8000${CL} \n" diff --git a/ct/vaultwarden-v3.sh b/ct/vaultwarden-v3.sh deleted file mode 100644 index 735160ff..00000000 --- a/ct/vaultwarden-v3.sh +++ /dev/null @@ -1,361 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Vaultwarden" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - __ __ _ _ _ - \ \ v3 / / | | | | | - \ \ / /_ _ _ _| | |___ ____ _ _ __ __| | ___ _ __ - \ \/ / _ | | | | | __\ \ /\ / / _ | __/ _ |/ _ \ _ \ - \ / (_| | |_| | | |_ \ V V / (_| | | | (_| | __/ | | | - \/ \__,_|\__,_|_|\__| \_/\_/ \__,_|_| \__,_|\___|_| |_| -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}6${CL}${DGN}GB${CL}" - DISK_SIZE="6" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}2048${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="2048" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 6 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="6"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 2048 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="2048"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/vaultwarden-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://github.com/tteck/Proxmox" - -msg_info "Setting Container to Normal Resources" -pct set $CTID -memory 512 -pct set $CTID -cores 1 -msg_ok "Set Container to Normal Resources" - -msg_ok "Completed Successfully!\n" -echo -e "${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:8000${CL} \n" diff --git a/ct/vaultwarden-v4.sh b/ct/vaultwarden-v4.sh index 9e5ffc70..a57b2191 100644 --- a/ct/vaultwarden-v4.sh +++ b/ct/vaultwarden-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/whoogle-v3.sh b/ct/whoogle-v3.sh deleted file mode 100644 index 59274f4e..00000000 --- a/ct/whoogle-v3.sh +++ /dev/null @@ -1,360 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -APP="Whoogle" -var_disk="2" -var_cpu="1" -var_ram="512" -var_os="debian" -var_version="11" -NEXTID=$(pvesh get /cluster/nextid) -INTEGER='^[0-9]+$' -NSAPP=$(echo ${APP,,} | tr -d ' ') -var_install="${NSAPP}-install" -PP=`echo "\e[1;35m"` -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 -} - -function msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} - -function msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${PP} - __ ___ _ ____ ____ _____ _ ______ - \ \ v3 / / | | |/ __ \ / __ \ / ____| | | ____| - \ \ /\ / /| |__| | | | | | | | | __| | | |__ - \ \/ \/ / | __ | | | | | | | | |_ | | | __| - \ /\ / | | | | |__| | |__| | |__| | |____| |____ - \/ \/ |_| |_|\____/ \____/ \_____|______|______| -${CL}" -} - -header_info - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${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}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}" - CORE_COUNT="$var_cpu" - echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -start_script - -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -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,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://github.com/tteck/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/whoogle-v4.sh b/ct/whoogle-v4.sh index a910806c..422e9d46 100644 --- a/ct/whoogle-v4.sh +++ b/ct/whoogle-v4.sh @@ -309,7 +309,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/wikijs-v4.sh b/ct/wikijs-v4.sh index 54b25b7b..486100a7 100644 --- a/ct/wikijs-v4.sh +++ b/ct/wikijs-v4.sh @@ -310,7 +310,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/wireguard-v2.sh b/ct/wireguard-v2.sh deleted file mode 100644 index 7137c4d3..00000000 --- a/ct/wireguard-v2.sh +++ /dev/null @@ -1,253 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New WireGuard LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - __ ___ _____ _ - \ \ / (_) / ____| | | - \ \ /\ / / _ _ __ ___| | __ _ _ __ _ _ __ __| | - \ \/ \/ / | | __/ _ \ | |_ | | | |/ _ | __/ _ | - \ /\ / | | | | __/ |__| | |_| | (_| | | | (_| | - \/ \/ |_|_| \___|\_____|\__,_|\__,_|_| \__,_| - ${YW}With WGDashboard -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${YW} Privileged ${CL}\n" - printf " ${YW} 2)${GN} Unprivileged ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=2 -export PCT_OPTIONS=" - -features $FEATURES - -hostname wireguard - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 1 - -memory 512 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/wireguard-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created WireGuard LXC to${CL} ${BL}$CTID${CL}. - -${BL}WGDashboard${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:10086${CL} \n" diff --git a/ct/wireguard-v3.sh b/ct/wireguard-v3.sh deleted file mode 100644 index 284f665c..00000000 --- a/ct/wireguard-v3.sh +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -APP="Wireguard" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - __ ___ _____ _ - \ \ / (_) / ____| | | - \ \ /\ / / _ _ __ ___| | __ _ _ __ _ _ __ __| | - \ \/ \/ / | | __/ _ \ | |_ | | | |/ _ | __/ _ | - \ /\ / | | | | __/ |__| | |_| | (_| | | | (_| | - \/ \/ v3|_|_| \___|\_____|\__,_|\__,_|_| \__,_| - ${YW}With WGDashboard -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}" - CT_TYPE="1" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}" - DISK_SIZE="2" - echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}" - CORE_COUNT="1" - echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="512" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type Privileged, or Press [ENTER] for Default: Unprivileged (${RD}NO DEVICE PASSTHROUGH${CL}${YW})" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Unprivileged" CT_TYPE="1"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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/wireguard-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://github.com/tteck/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/wireguard-v4.sh b/ct/wireguard-v4.sh index 946b6c00..95bfda0a 100644 --- a/ct/wireguard-v4.sh +++ b/ct/wireguard-v4.sh @@ -311,7 +311,7 @@ bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/c 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/zigbee2mqtt-v1.sh b/ct/zigbee2mqtt-v1.sh deleted file mode 100644 index 4e7d8c65..00000000 --- a/ct/zigbee2mqtt-v1.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env bash - -while true; do - read -p "This will create a New Zigbee2MQTT LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/zigbee2mqtt_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for storage location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC Template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=4G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=zigbee2mqtt -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 1024 \ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -lxc.cgroup2.devices.allow: c 188:* rwm -lxc.cgroup2.devices.allow: c 189:* rwm -lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir -lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID zigbee2mqtt_setup.sh /zigbee2mqtt_setup.sh -perms 755 -pct exec $CTID /zigbee2mqtt_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created zigbee2mqtt LXC Container to $CTID at IP Address ${IP}" -echo -echo -e "\e[1;31m Updating the configuration.yaml is required and found at /opt/zigbee2mqtt/data/ \e[0m" -echo -echo diff --git a/ct/zigbee2mqtt-v2.sh b/ct/zigbee2mqtt-v2.sh deleted file mode 100644 index f4a0c0fd..00000000 --- a/ct/zigbee2mqtt-v2.sh +++ /dev/null @@ -1,263 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -while true; do - read -p "This will create a New Zigbee2MQTT LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _______ _ ___ __ __ ____ _______ _______ - |___ (_) | | |__ \| \/ |/ __ \__ __|__ __| - / / _ __ _| |__ ___ ___ ) | \ / | | | | | | | | - / / | |/ _ | _ \ / _ \/ _ \ / /| |\/| | | | | | | | | - / /__| | (_| | |_) | __/ __// /_| | | | |__| | | | | | - /_____|_|\__, |____/ \___|\___|____|_| |_|\___\_\ |_| |_| - __/ | - |___/ - -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${GN} Privileged ${CL}\n" - printf " ${YW} 2)${RD} Unprivileged (no device passthrough) ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname zigbee2mqtt - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -lxc.cgroup2.devices.allow: c 188:* rwm -lxc.cgroup2.devices.allow: c 189:* rwm -lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir -lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/zigbee2mqtt-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created Zigbee2MQTT LXC to${CL} ${BL}$CTID${CL}. \n" diff --git a/ct/zigbee2mqtt-v3.sh b/ct/zigbee2mqtt-v3.sh deleted file mode 100644 index 46a61c82..00000000 --- a/ct/zigbee2mqtt-v3.sh +++ /dev/null @@ -1,369 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -CROSS="${RD}✗${CL}" -APP="Zigbee2MQTT" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${YW} - _______ _ ___ __ __ ____ _______ _______ - |___ (_) | | |__ \| \/ |/ __ \__ __|__ __| - / / _ __ _| |__ ___ ___ ) | \ / | | | | | | | | - / / | |/ _ | _ \ / _ \/ _ \ / /| |\/| | | | | | | | | - / /__| | (_| | |_) | __/ __// /_| | | | |__| | | | | | - /_____|_|\__, |____/ \___|\___|____|_| |_|\___\_\ |_| |_| - v3 __/ | - |___/ -${CL}" -} - -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type ${CROSS}${YW}Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -PVE_CHECK -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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: -lxc.cgroup2.devices.allow: c 188:* rwm -lxc.cgroup2.devices.allow: c 189:* rwm -lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir -lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file -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/zigbee2mqtt-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://github.com/tteck/Proxmox" - -msg_ok "Completed Successfully!\n" diff --git a/ct/zigbee2mqtt-v4.sh b/ct/zigbee2mqtt-v4.sh index 1d5e0bc8..53a0cc5b 100644 --- a/ct/zigbee2mqtt-v4.sh +++ b/ct/zigbee2mqtt-v4.sh @@ -324,7 +324,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/zwave-js-ui-v4.sh b/ct/zwave-js-ui-v4.sh index 46aa99ba..5928e9b9 100644 --- a/ct/zwave-js-ui-v4.sh +++ b/ct/zwave-js-ui-v4.sh @@ -324,7 +324,7 @@ fi 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 +lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$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/ diff --git a/ct/zwavejs2mqtt-v1.sh b/ct/zwavejs2mqtt-v1.sh deleted file mode 100644 index fb21a900..00000000 --- a/ct/zwavejs2mqtt-v1.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` - -while true; do - read -p "This will create a New Zwavejs2MQTT LXC Container. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${RD} - ______ _ ___ __ __ ____ _______ _______ - |___ / (_) |__ \| \/ |/ __ \__ __|__ __| - / /_ ____ ___ _____ _ ___ ) | \ / | | | | | | | | - / /\ \ /\ / / _ \ \ / / _ \ / __| / /| |\/| | | | | | | | | - / /__\ V V / (_| |\ V / __/ \__ \/ /_| | | | |__| | | | | | - /_____|\_/\_/ \__,_| \_/ \___| |___/____|_| |_|\___\_\ |_| |_| - _/ | - |__/ -${CL}" -} - -header_info - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -trap die ERR -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if [ ! -z ${MOUNT+x} ]; then - pct unmount $CTID - fi - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} -function load_module() { - if ! $(lsmod | grep -Fq $1); then - modprobe $1 &>/dev/null || \ - die "Failed to load '$1' module." - fi - MODULES_PATH=/etc/modules - if ! $(grep -Fxq "$1" $MODULES_PATH); then - echo "$1" >> $MODULES_PATH || \ - die "Failed to add '$1' module to load at boot." - fi -} -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/setup/zwavejs2mqtt_setup.sh - -load_module overlay - -while read -r line; do - TAG=$(echo $line | awk '{print $1}') - TYPE=$(echo $line | awk '{printf "%-10s", $2}') - FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') - ITEM=" Type: $TYPE Free: $FREE " - OFFSET=2 - if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then - MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) - fi - STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" ) -done < <(pvesm status -content rootdir | awk 'NR>1') -if [ $((${#STORAGE_MENU[@]}/3)) -eq 0 ]; then - warn "'Container' needs to be selected for at least one storage location." - die "Unable to detect valid storage location." -elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then - STORAGE=${STORAGE_MENU[0]} -else - while [ -z "${STORAGE:+x}" ]; do - STORAGE=$(whiptail --title "Storage Pools" --radiolist \ - "Which storage pool you would like to use for the container?\n\n" \ - 16 $(($MSG_MAX_LENGTH + 23)) 6 \ - "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit - done -fi -info "Using '$STORAGE' for Storage Location." - -CTID=$(pvesh get /cluster/nextid) -info "Container ID is $CTID." - -echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m" -pveam update >/dev/null -echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m" -OSTYPE=debian -OSVERSION=${OSTYPE}-11 -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V) -TEMPLATE="${TEMPLATES[-1]}" -pveam download local $TEMPLATE >/dev/null || - die "A problem occured while downloading the LXC template." - -STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') -case $STORAGE_TYPE in - dir|nfs) - DISK_EXT=".raw" - DISK_REF="$CTID/" - ;; - zfspool) - DISK_PREFIX="subvol" - DISK_FORMAT="subvol" - ;; -esac -DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-} -ROOTFS=${STORAGE}:${DISK_REF-}${DISK} - -echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m" -DISK_SIZE=4G -pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some containers may not work properly due to ZFS not supporting 'fallocate'." -else - mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null -fi -ARCH=$(dpkg --print-architecture) -HOSTNAME=zwavejs2mqtt -TEMPLATE_STRING="local:vztmpl/${TEMPLATE}" -pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \ - -hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 1024\ - -ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null - -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -lxc.cgroup2.devices.allow: c 188:* rwm -lxc.cgroup2.devices.allow: c 189:* rwm -lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir -lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file -EOF - -MOUNT=$(pct mount $CTID | cut -d"'" -f 2) -ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime -pct unmount $CTID && unset MOUNT - -echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m" -pct start $CTID -pct push $CTID zwavejs2mqtt_setup.sh /zwavejs2mqtt_setup.sh -perms 755 -pct exec $CTID /zwavejs2mqtt_setup.sh - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') -info "Successfully created a Zwavejs2MQTT LXC Container to $CTID at IP Address ${IP}:8091" diff --git a/ct/zwavejs2mqtt-v2.sh b/ct/zwavejs2mqtt-v2.sh deleted file mode 100644 index 72669df9..00000000 --- a/ct/zwavejs2mqtt-v2.sh +++ /dev/null @@ -1,266 +0,0 @@ -#!/usr/bin/env bash -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -APP="Zwavejs2MQTT" -HN=$(echo ${APP,,} | tr -d ' ') -while true; do - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - ______ _ ___ __ __ ____ _______ _______ - |___ / (_) |__ \| \/ |/ __ \__ __|__ __| - / /_ ____ ___ _____ _ ___ ) | \ / | | | | | | | | - / /\ \ /\ / / _ \ \ / / _ \ / __| / /| |\/| | | | | | | | | - / /__\ V V / (_| |\ V / __/ \__ \/ /_| | | | |__| | | | | | - /_____|\_/\_/ \__,_| \_/ \___| |___/____|_| |_|\___\_\ |_| |_| - _/ | - |__/ -${CL}" -} - -header_info -show_menu(){ - printf " ${YW} 1)${GN} Privileged ${CL}\n" - printf " ${YW} 2)${RD} Unprivileged (no device passthrough) ${CL}\n" - - printf "Please choose a Install Method and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message1=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" -} -show_menu -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Privileged Install"; - IM=0 - break; - ;; - 2) clear; - header_info; - option_picked "Using Unprivileged Install"; - IM=1 - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Install Method from the menu"; - show_menu; - ;; - esac - done -show_menu2(){ - printf " ${YW} 1)${GN} Use Automatic Login ${CL}\n" - printf " ${YW} 2)${GN} Use Password (changeme) ${CL}\n" - - printf "Please choose a Password Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message2=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" -} -show_menu2 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic Login"; - PW=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Password (changeme)"; - PW="-password changeme" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a Password Type from the menu"; - show_menu2; - ;; - esac - done -show_menu3(){ - printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" - printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" - - printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." - read opt -} - -option_picked(){ - message3=${@:-"${CL}Error: No message passed"} - printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message2}${CL}\n" - printf " ${YW}${message3}${CL}\n" -} -show_menu3 -while [ "$opt" != " " ] - do - case $opt in - 1) clear; - header_info; - option_picked "Using Automatic DHCP"; - DHCP=" " - break; - ;; - 2) clear; - header_info; - option_picked "Using Manual DHCP"; - DHCP="1" - break; - ;; - - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose a DHCP Type from the menu"; - show_menu3; - ;; - esac - done - -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 -trap cleanup EXIT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - [ ! -z ${CTID-} ] && cleanup_ctid - exit $EXIT -} -function warn() { - local REASON="\e[97m$1\e[39m" - local FLAG="\e[93m[WARNING]\e[39m" - msg "$FLAG $REASON" -} -function info() { - local REASON="$1" - local FLAG="\e[36m[INFO]\e[39m" - msg "$FLAG $REASON" -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -function cleanup_ctid() { - if $(pct status $CTID &>/dev/null); then - if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then - pct stop $CTID - fi - pct destroy $CTID - elif [ "$(pvesm list $STORAGE --vmid $CTID)" != "" ]; then - pvesm free $ROOTFS - fi -} -function cleanup() { - popd >/dev/null - rm -rf $TEMP_DIR -} - if [ "$IM" == "1" ]; then - FEATURES="nesting=1,keyctl=1" - else - FEATURES="nesting=1" - fi - -TEMP_DIR=$(mktemp -d) -pushd $TEMP_DIR >/dev/null - -export CTID=$(pvesh get /cluster/nextid) -export PCT_OSTYPE=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=4 -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=vmbr0,ip=dhcp - -onboot 1 - -cores 2 - -memory 1024 - -unprivileged ${IM} - ${PW} -" -bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit - -STORAGE_TYPE=$(pvesm status -storage $(pct config $CTID | grep rootfs | awk -F ":" '{print $2}') | awk 'NR>1 {print $2}') -if [ "$STORAGE_TYPE" == "zfspool" ]; then - warn "Some addons may not work due to ZFS not supporting 'fallocate'." -fi -LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <> $LXC_CONFIG -lxc.cgroup2.devices.allow: a -lxc.cap.drop: -lxc.cgroup2.devices.allow: c 188:* rwm -lxc.cgroup2.devices.allow: c 189:* rwm -lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir -lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file -EOF -if [ "$DHCP" == "1" ]; then -MAC=$(pct config $CTID \ -| grep -i hwaddr \ -| awk '{print substr($2, 31, length($3) 17 ) }') \ - -echo -e "MAC Address ${BL}$MAC${CL}" - -dhcp_reservation(){ - printf "Please set DHCP reservation and press Enter." - read -} -dhcp_reservation -fi - -echo -en "${GN} Starting LXC Container... " -pct start $CTID -echo -e "${CM}${CL} \r" - -alias lxc-cmd="lxc-attach -n $CTID --" - -lxc-cmd bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/$HN-install.sh)" || exit - -IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}') - -echo -e "${GN}Successfully created ${APP} LXC to${CL} ${BL}$CTID${CL}. -${BL}${APP}${CL} should be reachable by going to the following URL. - ${BL}http://${IP}:8091${CL} \n" diff --git a/ct/zwavejs2mqtt-v3.sh b/ct/zwavejs2mqtt-v3.sh deleted file mode 100644 index 88b9c87c..00000000 --- a/ct/zwavejs2mqtt-v3.sh +++ /dev/null @@ -1,371 +0,0 @@ -#!/usr/bin/env bash -echo -e "Loading..." -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}" -CROSS="${RD}✗${CL}" -APP="Zwavejs2MQTT" -NSAPP=$(echo ${APP,,} | tr -d ' ') -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 -} - -while true; do - clear - read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done -clear -function header_info { -echo -e "${BL} - ______ _ ___ __ __ ____ _______ _______ - |___ / (_) |__ \| \/ |/ __ \__ __|__ __| - / /_ ____ ___ _____ _ ___ ) | \ / | | | | | | | | - / /\ \ /\ / / _ \ \ / / _ \ / __| / /| |\/| | | | | | | | | - / /__\ V V / (_| |\ V / __/ \__ \/ /_| | | | |__| | | | | | - /_____|\_/\_/ \__,_| \_/ \___| |___/____|_| |_|\___\_\ |_| v3 |_| - _/ | - |__/ -${CL}" -} -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}" -} - -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() { - clear - header_info - echo -e "${BL}Using Default Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}Privileged${CL}" - CT_TYPE="0" - echo -e "${DGN}Using CT Password ${BGN}Automatic Login${CL}" - PW=" " - echo -e "${DGN}Using CT ID ${BGN}$NEXTID${CL}" - CT_ID=$NEXTID - echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}" - HN=$NSAPP - echo -e "${DGN}Using Disk Size ${BGN}4${CL}${DGN}GB${CL}" - DISK_SIZE="4" - echo -e "${DGN}Using ${BGN}2${CL}${DGN}vCPU${CL}" - CORE_COUNT="2" - echo -e "${DGN}Using ${BGN}1024${CL}${DGN}MiB RAM${CL}" - RAM_SIZE="1024" - 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}NONE${CL}" - GATE="" - echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}" - VLAN="" -} - -function advanced_settings() { - clear - header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${YW}Type ${CROSS}${YW}Unprivileged, or Press [ENTER] for Default: Privileged" - read CT_TYPE1 - if [ -z $CT_TYPE1 ]; then CT_TYPE1="Privileged" CT_TYPE="0"; - echo -en "${DGN}Set CT Type ${BL}$CT_TYPE1${CL}" - else - CT_TYPE1="Privileged" - CT_TYPE="0" - echo -en "${DGN}Set CT Type ${BL}Privileged${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${YW}Set Password, or Press [ENTER] for Default: Automatic Login " - read PW1 - if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; - echo -en "${DGN}Set CT ${BL}$PW1${CL}" - else - PW="-password $PW1" - echo -en "${DGN}Set CT Password ${BL}$PW1${CL}" - fi; -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${YW}Enter the CT ID, or Press [ENTER] to automatically generate (${NEXTID}) " - read CT_ID - if [ -z $CT_ID ]; then CT_ID=$NEXTID; fi; - echo -en "${DGN}Set CT ID To ${BL}$CT_ID${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${YW}Enter CT Name (no-spaces), or Press [ENTER] for Default: $NSAPP " - read CT_NAME - if [ -z $CT_NAME ]; then - HN=$NSAPP - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -en "${DGN}Set CT Name To ${BL}$HN${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 4 " - read DISK_SIZE - if [ -z $DISK_SIZE ]; then DISK_SIZE="4"; fi; - if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi; - echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 2 " - read CORE_COUNT - if [ -z $CORE_COUNT ]; then CORE_COUNT="2"; fi; - echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}" -echo -e " ${CM}${CL} \r" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 1024 " - read RAM_SIZE - if [ -z $RAM_SIZE ]; then RAM_SIZE="1024"; fi; - echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${YW}Enter a Bridge, or Press [ENTER] for Default: vmbr0 " - read BRG - if [ -z $BRG ]; then BRG="vmbr0"; fi; - echo -en "${DGN}Set Bridge To ${BL}$BRG${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${YW}Enter a Static IPv4 CIDR Address, or Press [ENTER] for Default: DHCP " - read NET - if [ -z $NET ]; then NET="dhcp"; fi; - echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}" -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${YW}Enter a Gateway IP (mandatory if static IP is used), or Press [ENTER] for Default: NONE " - read GATE1 - if [ -z $GATE1 ]; then GATE1="NONE" GATE=""; - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - else - GATE=",gw=$GATE1" - echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE " - read VLAN1 - if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN=""; - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - else - VLAN=",tag=$VLAN1" - echo -en "${DGN}Set VLAN Tag To ${BL}$VLAN1${CL}" - fi; -echo -e " ${CM}${CL} \n" -sleep 1 -clear -header_info - echo -e "${RD}Using Advanced Settings${CL}" - echo -e "${DGN}Using CT Type ${BGN}$CT_TYPE1${CL}" - echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}" - echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}" - echo -e "${DGN}Using CT Name ${BGN}$HN${CL}" - echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}" - echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}" - echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}" - echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}" - echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}" - echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}" - echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}" - -read -p "Are these settings correct(y/n)? " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - advanced_settings -fi -} - -function start_script() { - echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings " - read SETTINGS - if [ -z $SETTINGS ]; then default_settings; - else - advanced_settings - fi; -} - -PVE_CHECK -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=debian -export PCT_OSVERSION=11 -export PCT_DISK_SIZE=$DISK_SIZE -export PCT_OPTIONS=" - -features $FEATURES - -hostname $HN - -net0 name=eth0,bridge=$BRG,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: -lxc.cgroup2.devices.allow: c 188:* rwm -lxc.cgroup2.devices.allow: c 189:* rwm -lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir -lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file -lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file -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/zwavejs2mqtt-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://github.com/tteck/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/setup/adguard-install.sh b/install/adguard-install.sh similarity index 100% rename from setup/adguard-install.sh rename to install/adguard-install.sh diff --git a/setup/blocky-install.sh b/install/blocky-install.sh similarity index 100% rename from setup/blocky-install.sh rename to install/blocky-install.sh diff --git a/setup/casaos-install.sh b/install/casaos-install.sh similarity index 100% rename from setup/casaos-install.sh rename to install/casaos-install.sh diff --git a/setup/changedetection-install.sh b/install/changedetection-install.sh similarity index 100% rename from setup/changedetection-install.sh rename to install/changedetection-install.sh diff --git a/setup/daemonsync-install.sh b/install/daemonsync-install.sh similarity index 100% rename from setup/daemonsync-install.sh rename to install/daemonsync-install.sh diff --git a/setup/dashy-install.sh b/install/dashy-install.sh similarity index 100% rename from setup/dashy-install.sh rename to install/dashy-install.sh diff --git a/setup/debian-install.sh b/install/debian-install.sh similarity index 100% rename from setup/debian-install.sh rename to install/debian-install.sh diff --git a/setup/deconz-install.sh b/install/deconz-install.sh similarity index 100% rename from setup/deconz-install.sh rename to install/deconz-install.sh diff --git a/setup/docker-install.sh b/install/docker-install.sh similarity index 100% rename from setup/docker-install.sh rename to install/docker-install.sh diff --git a/setup/emby-install.sh b/install/emby-install.sh similarity index 100% rename from setup/emby-install.sh rename to install/emby-install.sh diff --git a/setup/emqx-install.sh b/install/emqx-install.sh similarity index 100% rename from setup/emqx-install.sh rename to install/emqx-install.sh diff --git a/setup/esphome-install.sh b/install/esphome-install.sh similarity index 100% rename from setup/esphome-install.sh rename to install/esphome-install.sh diff --git a/setup/grafana-install.sh b/install/grafana-install.sh similarity index 100% rename from setup/grafana-install.sh rename to install/grafana-install.sh diff --git a/setup/grocy-install.sh b/install/grocy-install.sh similarity index 100% rename from setup/grocy-install.sh rename to install/grocy-install.sh diff --git a/setup/heimdalldashboard-install.sh b/install/heimdalldashboard-install.sh similarity index 100% rename from setup/heimdalldashboard-install.sh rename to install/heimdalldashboard-install.sh diff --git a/setup/homeassistant-core-install.sh b/install/homeassistant-core-install.sh similarity index 100% rename from setup/homeassistant-core-install.sh rename to install/homeassistant-core-install.sh diff --git a/setup/homeassistant-install.sh b/install/homeassistant-install.sh similarity index 100% rename from setup/homeassistant-install.sh rename to install/homeassistant-install.sh diff --git a/setup/homebridge-install.sh b/install/homebridge-install.sh similarity index 100% rename from setup/homebridge-install.sh rename to install/homebridge-install.sh diff --git a/setup/homepage-install.sh b/install/homepage-install.sh similarity index 100% rename from setup/homepage-install.sh rename to install/homepage-install.sh diff --git a/setup/hyperion-install.sh b/install/hyperion-install.sh similarity index 100% rename from setup/hyperion-install.sh rename to install/hyperion-install.sh diff --git a/setup/influxdb-install.sh b/install/influxdb-install.sh similarity index 100% rename from setup/influxdb-install.sh rename to install/influxdb-install.sh diff --git a/setup/iobroker-install.sh b/install/iobroker-install.sh similarity index 100% rename from setup/iobroker-install.sh rename to install/iobroker-install.sh diff --git a/setup/jellyfin-install.sh b/install/jellyfin-install.sh similarity index 100% rename from setup/jellyfin-install.sh rename to install/jellyfin-install.sh diff --git a/setup/k0s-install.sh b/install/k0s-install.sh similarity index 100% rename from setup/k0s-install.sh rename to install/k0s-install.sh diff --git a/setup/keycloak-install.sh b/install/keycloak-install.sh similarity index 100% rename from setup/keycloak-install.sh rename to install/keycloak-install.sh diff --git a/setup/magicmirror-install.sh b/install/magicmirror-install.sh similarity index 100% rename from setup/magicmirror-install.sh rename to install/magicmirror-install.sh diff --git a/setup/mariadb-install.sh b/install/mariadb-install.sh similarity index 100% rename from setup/mariadb-install.sh rename to install/mariadb-install.sh diff --git a/setup/meshcentral-install.sh b/install/meshcentral-install.sh similarity index 100% rename from setup/meshcentral-install.sh rename to install/meshcentral-install.sh diff --git a/setup/motioneye-install.sh b/install/motioneye-install.sh similarity index 100% rename from setup/motioneye-install.sh rename to install/motioneye-install.sh diff --git a/setup/mqtt-install.sh b/install/mqtt-install.sh similarity index 100% rename from setup/mqtt-install.sh rename to install/mqtt-install.sh diff --git a/setup/n8n-install.sh b/install/n8n-install.sh similarity index 100% rename from setup/n8n-install.sh rename to install/n8n-install.sh diff --git a/setup/navidrome-install.sh b/install/navidrome-install.sh similarity index 100% rename from setup/navidrome-install.sh rename to install/navidrome-install.sh diff --git a/setup/nextcloudpi-install.sh b/install/nextcloudpi-install.sh similarity index 100% rename from setup/nextcloudpi-install.sh rename to install/nextcloudpi-install.sh diff --git a/setup/nginx-proxy-manager-install.sh b/install/nginx-proxy-manager-install.sh similarity index 100% rename from setup/nginx-proxy-manager-install.sh rename to install/nginx-proxy-manager-install.sh diff --git a/setup/nocodb-install.sh b/install/nocodb-install.sh similarity index 100% rename from setup/nocodb-install.sh rename to install/nocodb-install.sh diff --git a/setup/node-red-install.sh b/install/node-red-install.sh similarity index 100% rename from setup/node-red-install.sh rename to install/node-red-install.sh diff --git a/setup/omada-install.sh b/install/omada-install.sh similarity index 100% rename from setup/omada-install.sh rename to install/omada-install.sh diff --git a/setup/omv-install.sh b/install/omv-install.sh similarity index 100% rename from setup/omv-install.sh rename to install/omv-install.sh diff --git a/setup/openhab-install.sh b/install/openhab-install.sh similarity index 100% rename from setup/openhab-install.sh rename to install/openhab-install.sh diff --git a/setup/paperless-ngx-install.sh b/install/paperless-ngx-install.sh similarity index 100% rename from setup/paperless-ngx-install.sh rename to install/paperless-ngx-install.sh diff --git a/setup/photoprism-install.sh b/install/photoprism-install.sh similarity index 100% rename from setup/photoprism-install.sh rename to install/photoprism-install.sh diff --git a/setup/pihole-install.sh b/install/pihole-install.sh similarity index 100% rename from setup/pihole-install.sh rename to install/pihole-install.sh diff --git a/setup/plex-install.sh b/install/plex-install.sh similarity index 100% rename from setup/plex-install.sh rename to install/plex-install.sh diff --git a/setup/podman-homeassistant-install.sh b/install/podman-homeassistant-install.sh similarity index 100% rename from setup/podman-homeassistant-install.sh rename to install/podman-homeassistant-install.sh diff --git a/setup/podman-install.sh b/install/podman-install.sh similarity index 100% rename from setup/podman-install.sh rename to install/podman-install.sh diff --git a/setup/postgresql-install.sh b/install/postgresql-install.sh similarity index 100% rename from setup/postgresql-install.sh rename to install/postgresql-install.sh diff --git a/setup/prometheus-install.sh b/install/prometheus-install.sh similarity index 100% rename from setup/prometheus-install.sh rename to install/prometheus-install.sh diff --git a/setup/scrypted-install.sh b/install/scrypted-install.sh similarity index 100% rename from setup/scrypted-install.sh rename to install/scrypted-install.sh diff --git a/setup/shinobi-install.sh b/install/shinobi-install.sh similarity index 100% rename from setup/shinobi-install.sh rename to install/shinobi-install.sh diff --git a/setup/syncthing-install.sh b/install/syncthing-install.sh similarity index 100% rename from setup/syncthing-install.sh rename to install/syncthing-install.sh diff --git a/setup/technitiumdns-install.sh b/install/technitiumdns-install.sh similarity index 100% rename from setup/technitiumdns-install.sh rename to install/technitiumdns-install.sh diff --git a/setup/trilium-install.sh b/install/trilium-install.sh similarity index 100% rename from setup/trilium-install.sh rename to install/trilium-install.sh diff --git a/setup/ubuntu-install.sh b/install/ubuntu-install.sh similarity index 100% rename from setup/ubuntu-install.sh rename to install/ubuntu-install.sh diff --git a/setup/umbrel-install.sh b/install/umbrel-install.sh similarity index 100% rename from setup/umbrel-install.sh rename to install/umbrel-install.sh diff --git a/setup/unifi-install.sh b/install/unifi-install.sh similarity index 100% rename from setup/unifi-install.sh rename to install/unifi-install.sh diff --git a/setup/uptimekuma-install.sh b/install/uptimekuma-install.sh similarity index 100% rename from setup/uptimekuma-install.sh rename to install/uptimekuma-install.sh diff --git a/setup/vaultwarden-install.sh b/install/vaultwarden-install.sh similarity index 100% rename from setup/vaultwarden-install.sh rename to install/vaultwarden-install.sh diff --git a/setup/whoogle-install.sh b/install/whoogle-install.sh similarity index 100% rename from setup/whoogle-install.sh rename to install/whoogle-install.sh diff --git a/setup/wikijs-install.sh b/install/wikijs-install.sh similarity index 100% rename from setup/wikijs-install.sh rename to install/wikijs-install.sh diff --git a/setup/wireguard-install.sh b/install/wireguard-install.sh similarity index 100% rename from setup/wireguard-install.sh rename to install/wireguard-install.sh diff --git a/setup/zigbee2mqtt-install.sh b/install/zigbee2mqtt-install.sh similarity index 100% rename from setup/zigbee2mqtt-install.sh rename to install/zigbee2mqtt-install.sh diff --git a/setup/zwave-js-ui-install.sh b/install/zwave-js-ui-install.sh similarity index 100% rename from setup/zwave-js-ui-install.sh rename to install/zwave-js-ui-install.sh diff --git a/setup/adguard_setup.sh b/setup/adguard_setup.sh deleted file mode 100644 index bd48318d..00000000 --- a/setup/adguard_setup.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -y install \ - curl \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing AdGuard Home... \e[0m" -curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Customizing LXC... \e[0m" -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//') - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /adguard_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/debian11_setup.sh b/setup/debian11_setup.sh deleted file mode 100644 index e1cbf177..00000000 --- a/setup/debian11_setup.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null - -DOCKER_CONFIG_PATH='/etc/docker/daemon.json' -mkdir -p $(dirname $DOCKER_CONFIG_PATH) -cat >$DOCKER_CONFIG_PATH <<'EOF' -{ - "log-driver": "journald" -} -EOF - -echo -e "${CHECKMARK} \e[1;92m Customizing Container... \e[0m" -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//') - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /debian11_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/esphome_setup.sh b/setup/esphome_setup.sh deleted file mode 100644 index 001730f0..00000000 --- a/setup/esphome_setup.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -YW=`echo "\033[33m"` -BL=`echo "\033[36m"` -RD=`echo "\033[01;31m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -en "${GN} 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 -echo -e "${CM}${CL} \r" - -echo -en "${GN} Updating Container OS... " -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing Dependencies... " -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing pip3... " -apt-get install python3-pip -y &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing ESPHome... " -pip3 install esphome &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing ESPHome Dashboard... " -pip3 install tornado esptool &>/dev/null - -service_path="/etc/systemd/system/esphomeDashboard.service" -echo "[Unit] -Description=ESPHome Dashboard -After=network.target -[Service] -ExecStart=/usr/local/bin/esphome /root/config/ dashboard -Restart=always -User=root -[Install] -WantedBy=multi-user.target" > $service_path -systemctl enable esphomeDashboard.service &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} 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//') -systemctl start esphomeDashboard -echo -e "${CM}${CL} \r" - -echo -en "${GN} Cleanup... " -rm -rf /esphome_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* -echo -e "${CM}${CL} \r" diff --git a/setup/ha_setup.sh b/setup/ha_setup.sh deleted file mode 100644 index a97b62e8..00000000 --- a/setup/ha_setup.sh +++ /dev/null @@ -1,296 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing pip3... \e[0m" -apt-get install -y python3-pip &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Docker... \e[0m" -DOCKER_CONFIG_PATH='/etc/docker/daemon.json' -mkdir -p $(dirname $DOCKER_CONFIG_PATH) -cat >$DOCKER_CONFIG_PATH <<'EOF' -{ - "log-driver": "journald" -} -EOF -sh <(curl -sSL https://get.docker.com) &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Pulling Portainer Image...\e[0m" -docker pull portainer/portainer-ce:latest &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Portainer... \e[0m" -docker volume create portainer_data >/dev/null -docker run -d \ - -p 8000:8000 \ - -p 9000:9000 \ - --name=portainer \ - --restart=always \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v portainer_data:/data \ - portainer/portainer-ce:latest &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Pulling Home Assistant Image...\e[0m" -docker pull homeassistant/home-assistant:stable &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Home Assistant... \e[0m" -docker volume create hass_config >/dev/null -docker run -d \ - --name homeassistant \ - --privileged \ - --restart unless-stopped \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v /dev:/dev \ - -v hass_config:/config \ - -v /etc/localtime:/etc/localtime:ro \ - -v /etc/timezone:/etc/timezone:ro \ - --net=host \ - homeassistant/home-assistant:stable &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Creating Update Menu Script... \e[0m" -pip3 install runlike &>/dev/null -UPDATE_PATH='/root/update' -UPDATE_CONTAINERS_PATH='/root/update-containers.sh' -cat >$UPDATE_PATH <<'EOF' -#!/bin/sh -set -o errexit -show_menu(){ - normal=`echo "\033[m"` - safe=`echo "\033[32m"` - menu=`echo "\033[36m"` - number=`echo "\033[33m"` - bgred=`echo "\033[41m"` - fgred=`echo "\033[31m"` - hostname -I - printf "\n${menu}*********************************************${normal}\n" - printf "${menu}**${number} 1)${safe} Switch to Stable Branch ${normal}\n" - printf "${menu}**${number} 2)${number} Switch to Beta Branch ${normal}\n" - printf "${menu}**${number} 3)${fgred} Switch to Dev Branch ${normal}\n" - printf "${menu}**${number} 4)${safe} Backup Home Assistant Data (to root) ${normal}\n" - printf "${menu}**${number} 5)${number} Restore Home Assistant Data ${normal}\n" - printf "${menu}**${number} 6)${fgred} Edit Home Assistant Configuration ${normal}\n" - printf "${menu}**${number} 7)${safe} Restart Home Assistant ${normal}\n" - printf "${menu}**${number} 8)${safe} Just Update Containers ${normal}\n" - printf "${menu}**${number} 9)${number} Remove Unused Images ${normal}\n" - printf "${menu}**${number} 10)${safe} Update Host OS ${normal}\n" - printf "${menu}**${number} 11)${safe} Reboot Host OS ${normal}\n" - printf "${menu}*********************************************${normal}\n" - printf "Please choose an option from the menu and enter or ${fgred}x to exit. ${normal}" - read opt -} -option_picked(){ - msgcolor=`echo "\033[01;31m"` - normal=`echo "\033[00;00m"` - message=${@:-"${normal}Error: No message passed"} - printf "${msgcolor}${message}${normal}\n" -} -clear -show_menu -while [ $opt != '' ] - do - if [ $opt = '' ]; then - exit; - else - case $opt in - 1) clear; - option_picked "Switching to Stable Branch"; - TAG=stable - break; - ;; - 2) clear; - option_picked "Switching to Beta Branch"; - TAG=beta - break; - ;; - 3) while true; do - read -p "Are you sure you want to Switch to Dev Branch? Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac - done - clear; - option_picked "Switching to Dev Branch"; - TAG=dev - break; - ;; - 4) clear; - option_picked "Backing up Home Assistant Data to root (hass_config)"; - rm -r hass_config; - cp -pR /var/lib/docker/volumes/hass_config/ /root/; - sleep 2; - clear; - show_menu; - ;; - 5) while true; do - read -p "Are you sure you want to Restore Home Assistant Data? Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac - done - clear; - option_picked "Restoring Home Assistant Data from root (hass_config)"; - rm -r /var/lib/docker/volumes/hass_config/_data; - cp -pR /root/hass_config/_data /var/lib/docker/volumes/hass_config/; - sleep 2; - clear; - show_menu; - ;; - 6) while true; do - read -p "Are you sure you want to Edit Home Assistant Configuration? Proceed(y/n)?" yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac - done - clear; - option_picked "Editing Home Assistant Configuration"; - nano /var/lib/docker/volumes/hass_config/_data/configuration.yaml; - clear; - show_menu; - ;; - 7) clear; - option_picked "Restarting Home Assistant"; - docker restart homeassistant; - exit; - ;; - 8) clear; - option_picked "Just Updating Containers"; - ./update-containers.sh; - sleep 2; - clear; - show_menu; - ;; - 9) clear; - option_picked "Removing Unused Images"; - docker image prune -af; - sleep 2; - clear; - show_menu; - ;; - 10) clear; - option_picked "Updating Host OS"; - apt update && apt upgrade -y; - sleep 2; - clear; - show_menu; - ;; - 11) clear; - option_picked "Reboot Host OS"; - reboot; - exit; - ;; - x)exit; - ;; - \n)exit; - ;; - *)clear; - option_picked "Please choose an option from the menu"; - show_menu; - ;; - esac - fi - done -docker pull homeassistant/home-assistant:$TAG -docker rm --force homeassistant -docker run -d \ - --name homeassistant \ - --privileged \ - --restart unless-stopped \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v /dev:/dev \ - -v hass_config:/config \ - -v /etc/localtime:/etc/localtime:ro \ - -v /etc/timezone:/etc/timezone:ro \ - --net=host \ - homeassistant/home-assistant:$TAG -EOF -sudo chmod +x /root/update -cat >$UPDATE_CONTAINERS_PATH <<'EOF' -#!/bin/bash -set -o errexit -CONTAINER_LIST="${1:-$(docker ps -q)}" -for container in ${CONTAINER_LIST}; do - CONTAINER_IMAGE="$(docker inspect --format "{{.Config.Image}}" --type container ${container})" - RUNNING_IMAGE="$(docker inspect --format "{{.Image}}" --type container "${container}")" - docker pull "${CONTAINER_IMAGE}" - LATEST_IMAGE="$(docker inspect --format "{{.Id}}" --type image "${CONTAINER_IMAGE}")" - if [[ "${RUNNING_IMAGE}" != "${LATEST_IMAGE}" ]]; then - echo "Updating ${container} image ${CONTAINER_IMAGE}" - DOCKER_COMMAND="$(runlike "${container}")" - docker rm --force "${container}" - eval ${DOCKER_COMMAND} - fi -done -EOF -sudo chmod +x /root/update-containers.sh - -echo -e "${CHECKMARK} \e[1;92m Customizing LXC... \e[0m" -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//') -mkdir /root/hass_config -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /ha_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/jellyfin_setup.sh b/setup/jellyfin_setup.sh deleted file mode 100644 index 0f7a2549..00000000 --- a/setup/jellyfin_setup.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash - -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 -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=10 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" - apt-get update &>/dev/null - apt-get -qqy install \ - curl \ - sudo &>/dev/null - sudo apt install apt-transport-https -y &>/dev/null - sudo apt-get install software-properties-common -y &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Setting Up Jellyfin Repository... \e[0m" -sudo add-apt-repository universe -y &>/dev/null -wget -q -O - https://repo.jellyfin.org/ubuntu/jellyfin_team.gpg.key | sudo apt-key add - &>/dev/null -echo "deb [arch=$( dpkg --print-architecture )] https://repo.jellyfin.org/ubuntu $( lsb_release -c -s ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list &>/dev/null -echo -e "${CHECKMARK} \e[1;92m Installing Jellyfin... \e[0m" -apt-get update &>/dev/null -sudo apt install jellyfin-server -y &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Creating Jellyfin Service... \e[0m" -cat << 'EOF' > /lib/systemd/system/jellyfin.service -[Unit] -Description = Jellyfin Media Server -After = network.target - -[Service] -Type = simple -EnvironmentFile = /etc/default/jellyfin -User = root -ExecStart = /usr/bin/jellyfin ${JELLYFIN_WEB_OPT} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_FFMPEG_OPT} ${JELL> -Restart = on-failure -TimeoutSec = 15 - -[Install] -WantedBy = multi-user.target -EOF - -ln -s /usr/share/jellyfin/web/ /usr/lib/jellyfin/bin/jellyfin-web - -echo -e "${CHECKMARK} \e[1;92m Customizing Container... \e[0m" -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//') -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /jellyfin_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/mariadb_setup.sh b/setup/mariadb_setup.sh deleted file mode 100644 index b3d8b445..00000000 --- a/setup/mariadb_setup.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -RD=`echo "\033[01;31m"` -BL=`echo "\033[36m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -en "${GN} Setting up Container OS... " -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS}${RD} No Network! \r" - 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 -echo -e "${CM}${CL} \r" -echo -en "${GN} Network Connected: ${BL}$(hostname -I)${CL} " -echo -e "${CM}${CL} \r" - -echo -en "${GN} Updating Container OS... " -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing Dependencies... " -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing MariaDB... " -curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash &>/dev/null -apt-get update >/dev/null -apt-get install -y mariadb-server &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing Adminer... " -sudo apt install adminer -y &>/dev/null -sudo a2enconf adminer &>/dev/null -sudo systemctl reload apache2 &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} 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//') -echo -e "${CM}${CL} \r" - -echo -en "${GN} Cleanup... " -rm -rf /mariadb_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* -mkdir /var/log/apache2 -echo -e "${CM}${CL} \r" diff --git a/setup/motioneye_setup.sh b/setup/motioneye_setup.sh deleted file mode 100644 index ee7a6301..00000000 --- a/setup/motioneye_setup.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" - sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen - locale-gen >/dev/null - while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi - done -echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" - apt-get update &>/dev/null - apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" - apt-get update &>/dev/null - apt-get -qqy install \ - curl \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Motion... \e[0m" - apt-get install motion -y &>/dev/null - systemctl stop motion &>/dev/null - systemctl disable motion &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing FFmpeg... \e[0m" - apt-get install ffmpeg v4l-utils -y &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Python... \e[0m" - apt-get update &>/dev/null - apt-get install python2 -y &>/dev/null - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py &>/dev/null - python2 get-pip.py &>/dev/null - apt-get install libffi-dev libzbar-dev libzbar0 -y &>/dev/null - apt-get install python2-dev libssl-dev libcurl4-openssl-dev libjpeg-dev -y &>/dev/null -echo -e "${CHECKMARK} \e[1;92m Installing MotionEye... \e[0m" - apt-get update &>/dev/null - sudo pip install motioneye &>/dev/null - mkdir -p /etc/motioneye - cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf - mkdir -p /var/lib/motioneye - -echo -e "${CHECKMARK} \e[1;92m Creating Service file motioneye.service... \e[0m" - cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Customizing Container... \e[0m" - 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//') - systemctl enable motioneye &>/dev/null - systemctl start motioneye - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" - rm -rf /motioneye_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/mqtt_setup.sh b/setup/mqtt_setup.sh deleted file mode 100644 index 13d42531..00000000 --- a/setup/mqtt_setup.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - gnupg \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Mosquitto MQTT Broker.. \e[0m" -wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key &>/dev/null -apt-key add mosquitto-repo.gpg.key &>/dev/null -cd /etc/apt/sources.list.d/ -wget http://repo.mosquitto.org/debian/mosquitto-bullseye.list &>/dev/null -apt-get update >/dev/null -apt-get -y install mosquitto &>/dev/null -apt-get -y install mosquitto-clients &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Customizing LXC... \e[0m" -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//') - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /mqtt_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/node-red_setup.sh b/setup/node-red_setup.sh deleted file mode 100644 index def5d877..00000000 --- a/setup/node-red_setup.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Node-Red... \e[0m" -bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --confirm-root --confirm-install --skip-pi &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Customizing Container... \e[0m" -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//') -systemctl start nodered.service &>/dev/null -systemctl enable nodered.service &>/dev/null -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /node-red_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/npm_setup.sh b/setup/npm_setup.sh deleted file mode 100644 index c3917d44..00000000 --- a/setup/npm_setup.sh +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - sudo \ - curl \ - wget \ - gnupg \ - openssl \ - ca-certificates \ - apache2-utils \ - logrotate \ - build-essential \ - python3-dev \ - git \ - lsb-release &>/dev/null - - echo -e "${CHECKMARK} \e[1;92m Installing Python... \e[0m" - apt-get install -y -q --no-install-recommends python3 python3-pip python3-venv &>/dev/null - pip3 install --upgrade setuptools &>/dev/null - pip3 install --upgrade pip &>/dev/null - python3 -m venv /opt/certbot/ &>/dev/null - if [ "$(getconf LONG_BIT)" = "32" ]; then - python3 -m pip install --no-cache-dir -U cryptography==3.3.2 &>/dev/null - fi - python3 -m pip install --no-cache-dir cffi certbot &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Openresty... \e[0m" -wget -q -O - https://openresty.org/package/pubkey.gpg | apt-key add - &>/dev/null -codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release` &>/dev/null -echo "deb http://openresty.org/package/debian $codename openresty" | tee /etc/apt/sources.list.d/openresty.list &>/dev/null -apt-get -y update &>/dev/null -apt-get -y install --no-install-recommends openresty &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Setting up Node.js Repository... \e[0m" -sudo curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Node.js... \e[0m" -sudo apt-get install -y nodejs git make g++ gcc &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Yarn... \e[0m" -npm install --global yarn &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Downloading NPM v2.9.16... \e[0m" -wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v2.9.16 -O - | tar -xz &>/dev/null -cd ./nginx-proxy-manager-2.9.16 - -echo -e "${CHECKMARK} \e[1;92m Setting up Enviroment... \e[0m" -ln -sf /usr/bin/python3 /usr/bin/python -ln -sf /usr/bin/certbot /opt/certbot/bin/certbot -ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx -ln -sf /usr/local/openresty/nginx/ /etc/nginx - -sed -i "s+0.0.0+#v2.9.16+g" backend/package.json -sed -i "s+0.0.0+#v2.9.16+g" frontend/package.json - -sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf -NGINX_CONFS=$(find "$(pwd)" -type f -name "*.conf") -for NGINX_CONF in $NGINX_CONFS; do - sed -i 's+include conf.d+include /etc/nginx/conf.d+g' "$NGINX_CONF" -done - -mkdir -p /var/www/html /etc/nginx/logs -cp -r docker/rootfs/var/www/html/* /var/www/html/ -cp -r docker/rootfs/etc/nginx/* /etc/nginx/ -cp docker/rootfs/etc/letsencrypt.ini /etc/letsencrypt.ini -cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-proxy-manager -ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf -rm -f /etc/nginx/conf.d/dev.conf - -mkdir -p /tmp/nginx/body \ -/run/nginx \ -/data/nginx \ -/data/custom_ssl \ -/data/logs \ -/data/access \ -/data/nginx/default_host \ -/data/nginx/default_www \ -/data/nginx/proxy_host \ -/data/nginx/redirection_host \ -/data/nginx/stream \ -/data/nginx/dead_host \ -/data/nginx/temp \ -/var/lib/nginx/cache/public \ -/var/lib/nginx/cache/private \ -/var/cache/nginx/proxy_temp - -chmod -R 777 /var/cache/nginx -chown root /tmp/nginx - -echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" > /etc/nginx/conf.d/include/resolvers.conf - -if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then - echo -e "${CHECKMARK} \e[1;92m Generating dummy SSL Certificate... \e[0m" - openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost" -keyout /data/nginx/dummykey.pem -out /data/nginx/dummycert.pem &>/dev/null -fi - -mkdir -p /app/global /app/frontend/images -cp -r backend/* /app -cp -r global/* /app/global - -echo -e "${CHECKMARK} \e[1;92m Building Frontend... \e[0m" -cd ./frontend -export NODE_ENV=development -yarn install --network-timeout=30000 &>/dev/null -yarn build &>/dev/null -cp -r dist/* /app/frontend -cp -r app-images/* /app/frontend/images - -echo -e "${CHECKMARK} \e[1;92m Initializing Backend... \e[0m" -rm -rf /app/config/default.json &>/dev/null -if [ ! -f /app/config/production.json ]; then -cat << 'EOF' > /app/config/production.json -{ - "database": { - "engine": "knex-native", - "knex": { - "client": "sqlite3", - "connection": { - "filename": "/data/database.sqlite" - } - } - } -} -EOF -fi -cd /app -export NODE_ENV=development -yarn install --network-timeout=30000 &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Creating NPM Service... \e[0m" -cat << 'EOF' > /lib/systemd/system/npm.service -[Unit] -Description=Nginx Proxy Manager -After=network.target -Wants=openresty.service - -[Service] -Type=simple -Environment=NODE_ENV=production -ExecStartPre=-mkdir -p /tmp/nginx/body /data/letsencrypt-acme-challenge -ExecStart=/usr/bin/node index.js --abort_on_uncaught_exception --max_old_space_size=250 -WorkingDirectory=/app -Restart=on-failure - -[Install] -WantedBy=multi-user.target -EOF - -echo -e "${CHECKMARK} \e[1;92m Customizing Container... \e[0m" -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//') - -echo -e "${CHECKMARK} \e[1;92m Starting Services... \e[0m" -systemctl enable npm &>/dev/null -systemctl start openresty -systemctl start npm - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /npm_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/pihole_setup.sh b/setup/pihole_setup.sh deleted file mode 100644 index d6d7eb4e..00000000 --- a/setup/pihole_setup.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up LXC OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Pi-hole... \e[0m" -curl -sSL https://install.pi-hole.net | bash - -echo -e "${CHECKMARK} \e[1;92m Customizing LXC... \e[0m" -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//') - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /pihole_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/plex_setup.sh b/setup/plex_setup.sh deleted file mode 100644 index 8d10d71a..00000000 --- a/setup/plex_setup.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=10 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo \ - gnupg &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Setting Up Hardware Acceleration... \e[0m" -apt-get -y install \ - va-driver-all \ - ocl-icd-libopencl1 \ - beignet-opencl-icd &>/dev/null - -/bin/chgrp video /dev/dri -/bin/chmod 755 /dev/dri -/bin/chmod 660 /dev/dri/* - -echo -e "${CHECKMARK} \e[1;92m Setting Up Plex Media Server Repository... \e[0m" -wget -q https://downloads.plex.tv/plex-keys/PlexSign.key -O - | sudo apt-key add - &>/dev/null -echo "deb [arch=$( dpkg --print-architecture )] https://downloads.plex.tv/repo/deb/ public main" | tee /etc/apt/sources.list.d/plexmediaserver.list &>/dev/null -echo -e "${CHECKMARK} \e[1;92m Installing Plex Media Server... \e[0m" -apt-get update &>/dev/null -apt-get -o Dpkg::Options::="--force-confold" install -y plexmediaserver &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Customizing Container... \e[0m" -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//') -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /plex_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/podman_ha_setup.sh b/setup/podman_ha_setup.sh deleted file mode 100644 index 8cc8d414..00000000 --- a/setup/podman_ha_setup.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env bash - -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 -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -RD=`echo "\033[01;31m"` -BL=`echo "\033[36m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -RETRY_NUM=10 -RETRY_EVERY=3 -NUM=$RETRY_NUM - -echo -en "${GN} 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 -echo -e "${CM}${CL} \r" -echo -en "${GN} Network Connected: ${BL}$(hostname -I)${CL} " -echo -e "${CM}${CL} \r" - -echo -en "${GN} Updating Container OS... " -apt update &>/dev/null -apt-get -qqy upgrade &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing Dependencies... " -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo \ - runc &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing Podman... " -apt-get -y install podman &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Pulling Yacht Image... " -podman pull docker.io/selfhostedpro/yacht:latest &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing Yacht... " -podman volume create yacht >/dev/null -podman run -d \ - --privileged \ - --name yacht \ - --restart always \ - -v /var/run/podman/podman.sock:/var/run/docker.sock \ - -v yacht:/config \ - -v /etc/localtime:/etc/localtime:ro \ - -v /etc/timezone:/etc/timezone:ro \ - -p 8000:8000 \ - selfhostedpro/yacht:latest &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Pulling Home Assistant Image... " -podman pull docker.io/homeassistant/home-assistant:stable &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Installing Home Assistant... " -podman volume create hass_config >/dev/null -podman run -d \ - --privileged \ - --name homeassistant \ - --restart unless-stopped \ - -v /dev:/dev \ - -v hass_config:/config \ - -v /etc/localtime:/etc/localtime:ro \ - -v /etc/timezone:/etc/timezone:ro \ - --net=host \ - homeassistant/home-assistant:stable &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Creating Update Script... " -file_path="/root/update.sh" -echo "#!/bin/bash -echo -e '\e[1;33m Pulling New Stable Version... \e[0m' -podman pull docker.io/homeassistant/home-assistant:stable -echo -e '\e[1;33m Stopping Home Assistant... \e[0m' -podman stop homeassistant -echo -e '\e[1;33m Removing Home Assistant... \e[0m' -podman rm homeassistant -echo -e '\e[1;33m Starting Home Assistant... \e[0m' -podman run -d \ - --name homeassistant \ - --restart unless-stopped \ - -v /dev:/dev \ - -v hass_config:/config \ - -v /etc/localtime:/etc/localtime:ro \ - -v /etc/timezone:/etc/timezone:ro \ - --net=host \ - homeassistant/home-assistant:stable -echo -e '\e[1;33m Removing Old Image... \e[0m' -podman image prune -f -echo -e '\e[1;33m Finished Update! \e[0m'" > $file_path -sudo chmod +x /root/update.sh -echo -e "${CM}${CL} \r" - -echo -en "${GN} Customizing LXC... " -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//') - -podman generate systemd \ - --new --name homeassistant \ - > /etc/systemd/system/homeassistant.service -systemctl enable homeassistant &>/dev/null - -podman generate systemd \ - --new --name yacht \ - > /etc/systemd/system/yacht.service -systemctl enable yacht &>/dev/null -echo -e "${CM}${CL} \r" - -echo -en "${GN} Cleanup... " -rm -rf /podman_ha_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* -echo -e "${CM}${CL} \n" diff --git a/setup/ubuntu_setup.sh b/setup/ubuntu_setup.sh deleted file mode 100644 index ea116c5b..00000000 --- a/setup/ubuntu_setup.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null - -DOCKER_CONFIG_PATH='/etc/docker/daemon.json' -mkdir -p $(dirname $DOCKER_CONFIG_PATH) -cat >$DOCKER_CONFIG_PATH <<'EOF' -{ - "log-driver": "journald" -} -EOF - -echo -e "${CHECKMARK} \e[1;92m Customizing LXC... \e[0m" -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//') - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /ubuntu_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/vault_setup.sh b/setup/vault_setup.sh deleted file mode 100644 index 57f2117c..00000000 --- a/setup/vault_setup.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RD=`echo "\033[01;31m"` -BL=`echo "\033[36m"` -CM='\xE2\x9C\x94\033' -GN=`echo "\033[1;92m"` -CL=`echo "\033[m"` -RETRY_NUM=10 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - git \ - nano \ - wget \ - htop \ - pkg-config \ - openssl \ - libssl1.1 \ - libssl-dev \ - curl \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Build Essentials... \e[0m" -apt-get install -y build-essential &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Rust... \e[0m" -curl https://sh.rustup.rs -sSf | sh -s -- -y &>/dev/null -echo 'export PATH=~/.cargo/bin:$PATH' >> ~/.bashrc &>/dev/null -export PATH=~/.cargo/bin:$PATH &>/dev/null -which rustc &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Node.js... \e[0m" -curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &>/dev/null -apt-get install -y nodejs &>/dev/null -npm -g install npm@7 &>/dev/null -which npm &>/dev/null -npm i npm@latest -g &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Building Vaultwarden (Patience)... \e[0m" -git clone https://github.com/dani-garcia/vaultwarden &>/dev/null -pushd vaultwarden &>/dev/null -cargo clean &>/dev/null -cargo build --features sqlite --release &>/dev/null -file target/release/vaultwarden &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Building Web-Vault... \e[0m" -pushd target/release/ &>/dev/null -git clone --recurse-submodules https://github.com/bitwarden/web.git web-vault.git &>/dev/null -cd web-vault.git &>/dev/null -git checkout v2.25.1 &>/dev/null -git submodule update --init --recursive &>/dev/null -wget https://raw.githubusercontent.com/dani-garcia/bw_web_builds/master/patches/v2.25.0.patch &>/dev/null -git apply v2.25.0.patch &>/dev/null -npm ci --silent --legacy-peer-deps &>/dev/null -npm audit fix --silent --legacy-peer-deps || true &>/dev/null -npm run --silent dist:oss:selfhost &>/dev/null -cp -a build ../web-vault &>/dev/null -cd .. -mkdir data - -echo -e "${CHECKMARK} \e[1;92m Create Systemd Service... \e[0m" -cp ../../.env.template /etc/vaultwarden.env &>/dev/null -cp vaultwarden /usr/bin/vaultwarden &>/dev/null -chmod +x /usr/bin/vaultwarden &>/dev/null -useradd -m -d /var/lib/vaultwarden vaultwarden &>/dev/null -sudo cp -R data /var/lib/vaultwarden/ &>/dev/null -cp -R web-vault /var/lib/vaultwarden/ &>/dev/null -chown -R vaultwarden:vaultwarden /var/lib/vaultwarden &>/dev/null - -service_path="/etc/systemd/system/vaultwarden.service" &>/dev/null - -echo "[Unit] -Description=Bitwarden Server (Powered by Vaultwarden) -Documentation=https://github.com/dani-garcia/vaultwarden - -After=network.target - -[Service] -User=vaultwarden -Group=vaultwarden -EnvironmentFile=/etc/vaultwarden.env -ExecStart=/usr/bin/vaultwarden -LimitNOFILE=1048576 -LimitNPROC=64 -PrivateTmp=true -PrivateDevices=true -ProtectHome=true -ProtectSystem=strict -WorkingDirectory=/var/lib/vaultwarden -ReadWriteDirectories=/var/lib/vaultwarden -AmbientCapabilities=CAP_NET_BIND_SERVICE - -[Install] -WantedBy=multi-user.target" > $service_path - -echo -e "${CHECKMARK} \e[1;92m Customizing Container... \e[0m" -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//') -systemctl enable vaultwarden.service &>/dev/null -systemctl start vaultwarden.service &>/dev/null -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /vault_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/zigbee2mqtt_setup.sh b/setup/zigbee2mqtt_setup.sh deleted file mode 100644 index d0ce0c01..00000000 --- a/setup/zigbee2mqtt_setup.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Setting up Node.js Repository... \e[0m" -sudo curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Node.js... \e[0m" -sudo apt-get install -y nodejs git make g++ gcc &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Setting up Zigbee2MQTT Repository... \e[0m" -sudo git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Zigbee2MQTT... \e[0m" -cd /opt/zigbee2mqtt &>/dev/null -npm ci &>/dev/null - -service_path="/etc/systemd/system/zigbee2mqtt.service" -echo "[Unit] -Description=zigbee2mqtt -After=network.target -[Service] -ExecStart=/usr/bin/npm start -WorkingDirectory=/opt/zigbee2mqtt -StandardOutput=inherit -StandardError=inherit -Restart=always -User=root -[Install] -WantedBy=multi-user.target" > $service_path - -echo -e "${CHECKMARK} \e[1;92m Customizing LXC... \e[0m" -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//') -systemctl enable zigbee2mqtt.service &>/dev/null -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /zigbee2mqtt_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* diff --git a/setup/zwavejs2mqtt_setup.sh b/setup/zwavejs2mqtt_setup.sh deleted file mode 100644 index b4cdd610..00000000 --- a/setup/zwavejs2mqtt_setup.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -shopt -s expand_aliases -alias die='EXIT=$? LINE=$LINENO error_exit' -CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' -RETRY_NUM=5 -RETRY_EVERY=3 -NUM=$RETRY_NUM -trap die ERR -trap 'die "Script interrupted."' INT - -function error_exit() { - trap - ERR - local DEFAULT='Unknown failure occured.' - local REASON="\e[97m${1:-$DEFAULT}\e[39m" - local FLAG="\e[91m[ERROR:LXC] \e[93m$EXIT@$LINE" - msg "$FLAG $REASON" - exit $EXIT -} -function msg() { - local TEXT="$1" - echo -e "$TEXT" -} - -echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m" -sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen -locale-gen >/dev/null -while [ "$(hostname -I)" = "" ]; do - 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" - sleep $RETRY_EVERY - ((NUM--)) - if [ $NUM -eq 0 ] - then - 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" - exit 1 - fi -done - echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" - -echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m" -apt-get update &>/dev/null -apt-get -qqy upgrade &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Installing Prerequisites... \e[0m" -apt-get update &>/dev/null -apt-get -qqy install \ - curl \ - sudo \ - unzip &>/dev/null - - echo -e "${CHECKMARK} \e[1;92m Setting up Node.js Repository... \e[0m" - sudo curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - &>/dev/null - - echo -e "${CHECKMARK} \e[1;92m Installing Node.js... \e[0m" - sudo apt-get install -y nodejs git make g++ gcc &>/dev/null - - echo -e "${CHECKMARK} \e[1;92m Installing yarn... \e[0m" - npm install --global yarn &>/dev/null - - echo -e "${CHECKMARK} \e[1;92m Build/Install Zwavejs2MQTT (5-6 min)... \e[0m" - sudo git clone https://github.com/zwave-js/zwavejs2mqtt /opt/zwavejs2mqtt &>/dev/null - cd /opt/zwavejs2mqtt &>/dev/null - yarn install &>/dev/null - yarn run build &>/dev/null - -echo -e "${CHECKMARK} \e[1;92m Creating Service file zwavejs2mqtt.service... \e[0m" -service_path="/etc/systemd/system/zwavejs2mqtt.service" - -echo "[Unit] -Description=zwavejs2mqtt -After=network.target -[Service] -ExecStart=/usr/bin/npm start -WorkingDirectory=/opt/zwavejs2mqtt -StandardOutput=inherit -StandardError=inherit -Restart=always -User=root -[Install] -WantedBy=multi-user.target" > $service_path - -echo -e "${CHECKMARK} \e[1;92m Customizing container... \e[0m" -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//') - -echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m" -rm -rf /zwavejs2mqtt_setup.sh /var/{cache,log}/* /var/lib/apt/lists/* -systemctl start zwavejs2mqtt -systemctl enable zwavejs2mqtt &>/dev/null