mirror of
https://github.com/tteck/Proxmox.git
synced 2024-12-23 15:38:50 +01:00
Update adguard_container.sh
This commit is contained in:
parent
8a2568fd61
commit
44f1fa2843
@ -15,6 +15,7 @@ set -o nounset
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||||
|
CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
|
||||||
trap die ERR
|
trap die ERR
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
@ -105,9 +106,10 @@ info "Using '$STORAGE' for storage location."
|
|||||||
CTID=$(pvesh get /cluster/nextid)
|
CTID=$(pvesh get /cluster/nextid)
|
||||||
info "LXC ID is $CTID."
|
info "LXC ID is $CTID."
|
||||||
|
|
||||||
msg "Updating LXC template list..."
|
echo -e "${CHECKMARK} \e[1;92m Updating LXC Template List... \e[0m"
|
||||||
pveam update >/dev/null
|
pveam update >/dev/null
|
||||||
msg "Downloading LXC template..."
|
|
||||||
|
echo -e "${CHECKMARK} \e[1;92m Downloading LXC Template... \e[0m"
|
||||||
OSTYPE=debian
|
OSTYPE=debian
|
||||||
OSVERSION=${OSTYPE}-11
|
OSVERSION=${OSTYPE}-11
|
||||||
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V)
|
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V)
|
||||||
@ -129,7 +131,7 @@ esac
|
|||||||
DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-}
|
DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-}
|
||||||
ROOTFS=${STORAGE}:${DISK_REF-}${DISK}
|
ROOTFS=${STORAGE}:${DISK_REF-}${DISK}
|
||||||
|
|
||||||
msg "Creating LXC..."
|
echo -e "${CHECKMARK} \e[1;92m Creating LXC... \e[0m"
|
||||||
DISK_SIZE=2G
|
DISK_SIZE=2G
|
||||||
pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null
|
pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null
|
||||||
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
||||||
@ -148,10 +150,13 @@ MOUNT=$(pct mount $CTID | cut -d"'" -f 2)
|
|||||||
ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime
|
ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime
|
||||||
pct unmount $CTID && unset MOUNT
|
pct unmount $CTID && unset MOUNT
|
||||||
|
|
||||||
msg "Starting LXC..."
|
echo -e "${CHECKMARK} \e[1;92m Starting LXC... \e[0m"
|
||||||
pct start $CTID
|
pct start $CTID
|
||||||
pct push $CTID adguard_setup.sh /adguard_setup.sh -perms 755
|
pct push $CTID adguard_setup.sh /adguard_setup.sh -perms 755
|
||||||
pct exec $CTID /adguard_setup.sh
|
pct exec $CTID /adguard_setup.sh
|
||||||
|
|
||||||
IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}')
|
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 at IP Address ${IP}"
|
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"
|
||||||
|
Loading…
Reference in New Issue
Block a user