diff --git a/manager.sh b/manager.sh index 98bce3a..864ecbd 100644 --- a/manager.sh +++ b/manager.sh @@ -2,7 +2,7 @@ set -euo pipefail # Path to the variables log file -VARIABLES_LOG="/rescue/variables.log" +VARIABLES_LOG="/root/variables.log" # Auto-elevate script if not running as root if [ "$EUID" -ne 0 ]; then @@ -62,12 +62,63 @@ else fi # Ensure necessary mount points are available before mounting -mkdir -p /rescue/boot -mkdir -p /rescue/home -mkdir -p /rescue/proc -mkdir -p /rescue/sys -mkdir -p /rescue/dev/pts -mkdir -p /rescue/run +if [ -d /rescue/boot ]; then + echo "/rescue/boot exists already, continuing..." +else + echo "Creating /rescue/boot directory..." + mkdir -p /rescue/boot +fi + +if [ -d /rescue/home ]; then + echo "/rescue exists already, continuing..." +else + echo "Creating /rescue/home directory..." + mkdir -p /rescue/home +fi + +if [ -d /rescue ]; then + echo "/rescue exists already, continuing..." +else + echo "Creating /rescue directory..." + mkdir -p /rescue +fi +# ----------------------------------------------------- # + +if [ -d /rescue/proc ]; then + echo "/rescue/proc exists already, continuing..." +else + echo "Creating /rescue/proc directory..." + mkdir -p /rescue/proc +fi + +if [ -d /rescue/sys ]; then + echo "/rescue/sys exists already, continuing..." +else + echo "Creating /rescue directory..." + mkdir -p /rescue/sys +fi + +if [ -d /rescue/dev/pts ]; then + echo "/rescue/dev/pts exists already, continuing..." +else + echo "Creating /rescue/dev/pts directory..." + mkdir -p /rescue +fi + +if [ -d /rescue/run ]; then + echo "/rescue exists already, continuing..." +else + echo "Creating /rescue/run directory..." + mkdir -p /rescue/run +fi +# ----------------------------------------------------- # + +if [ -d /rescue/boot ] && [ -d /rescue/home ] && [ -d /rescue/proc ] && [ -d /rescue/sys ] && [ -d /rescue/dev/pts ] && [ -d /rescue/run ]; then + echo "All required directories exist. Proceeding with mounting procedure..." +else + echo "One or more required directories are missing. Please create them before chrooting." + exit 1 +fi # Mount the partitions echo "Mounting OS partition..."