From ea45c6a033b56fd6571ba757af312034b58b1705 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 20 Mar 2025 02:08:20 +0100 Subject: [PATCH] Delete src/reset.sh --- src/reset.sh | 175 --------------------------------------------------- 1 file changed, 175 deletions(-) delete mode 100644 src/reset.sh diff --git a/src/reset.sh b/src/reset.sh deleted file mode 100644 index 5ced84a..0000000 --- a/src/reset.sh +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR - -[ ! -f "/run/entry.sh" ] && error "Script must run inside Docker container!" && exit 11 -[ "$(id -u)" -ne "0" ] && error "Script must be executed with root privileges." && exit 12 - -echo "❯ Starting $APP for Docker v$(/dev/null && error "Invalid RAM_SIZE: $RAM_SIZE" && exit 16 -RAM_WANTED=$(numfmt --from=iec "$RAM_SIZE") -[ "$RAM_WANTED" -lt "136314880 " ] && error "RAM_SIZE is too low: $RAM_SIZE" && exit 16 - -# Print system info -SYS="${SYS/-generic/}" -FS=$(stat -f -c %T "$STORAGE") -FS="${FS/UNKNOWN //}" -FS="${FS/ext2\/ext3/ext4}" -FS=$(echo "$FS" | sed 's/[)(]//g') -SPACE=$(df --output=avail -B 1 "$STORAGE" | tail -n 1) -SPACE_GB=$(formatBytes "$SPACE" "down") -AVAIL_MEM=$(formatBytes "$RAM_AVAIL" "down") -TOTAL_MEM=$(formatBytes "$RAM_TOTAL" "up") - -echo "❯ CPU: ${CPU} | RAM: ${AVAIL_MEM/ GB/}/$TOTAL_MEM | DISK: $SPACE_GB (${FS}) | KERNEL: ${SYS}..." -echo - -# Check compatibilty - -if [[ "${FS,,}" == "ecryptfs" ]] || [[ "${FS,,}" == "tmpfs" ]]; then - DISK_IO="threads" - DISK_CACHE="writeback" -fi - -if [[ "${BOOT_MODE:-}" == "windows"* ]]; then - if [[ "${FS,,}" == "btrfs" ]]; then - warn "you are using the BTRFS filesystem for /storage, this might introduce issues with Windows Setup!" - fi -fi - -# Check available memory - -if [[ "$RAM_CHECK" != [Nn]* ]] && (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then - AVAIL_MEM=$(formatBytes "$RAM_AVAIL") - msg="Your configured RAM_SIZE of ${RAM_SIZE/G/ GB} is too high for the $AVAIL_MEM of memory available, please set a lower value." - [[ "${FS,,}" != "zfs" ]] && error "$msg" && exit 17 - info "$msg" -fi - -addPackage() { - local pkg=$1 - local desc=$2 - - if apt-mark showinstall | grep -qx "$pkg"; then - return 0 - fi - - MSG="Installing $desc..." - info "$MSG" && html "$MSG" - - DEBIAN_FRONTEND=noninteractive apt-get -qq update - DEBIAN_FRONTEND=noninteractive apt-get -qq --no-install-recommends -y install "$pkg" > /dev/null - - return 0 -} - -user="admin" -[ -n "${USER:-}" ] && user="${USER:-}" - -if [ -n "${PASS:-}" ]; then - - sed -i "s/auth_basic off/auth_basic \"NoVNC\"/g" /etc/nginx/sites-enabled/web.conf - -else - - sed -i "s/auth_basic \"NoVNC\"/auth_basic off/g" /etc/nginx/sites-enabled/web.conf - -fi - -# Set password -echo "$user:{PLAIN}${PASS:-}" > /etc/nginx/.htpasswd - -# shellcheck disable=SC2143 -if [ -f /proc/net/if_inet6 ] && [ -n "$(ifconfig -a | grep inet6)" ]; then - - sed -i "s/listen 8006 default_server;/listen [::]:8006 default_server ipv6only=off;/g" /etc/nginx/sites-enabled/web.conf - -else - - sed -i "s/listen [::]:8006 default_server ipv6only=off;/listen 8006 default_server;/g" /etc/nginx/sites-enabled/web.conf - -fi - -# Start webserver -cp -r /var/www/* /run/shm -html "Starting $APP for Docker..." -nginx -e stderr - -return 0