diff --git a/custom-scripts/scripts b/custom-scripts/scripts.lst similarity index 100% rename from custom-scripts/scripts rename to custom-scripts/scripts.lst diff --git a/install-stage2.sh b/install-stage2.sh index 109e64b..55e4135 100644 --- a/install-stage2.sh +++ b/install-stage2.sh @@ -81,6 +81,7 @@ fi STAGE2_DIR="/opt/void-usb/installer/" # Change this to your desired directory CONFIG_DIR="$STAGE2_DIR/custom-scripts" +SCRIPT_LIST="$CONFIG_DIR/scripts.lst" SCRIPTS=() NAMES=() DESCRIPTIONS=() @@ -92,11 +93,11 @@ for script in "$CONFIG_DIR"/*.sh; do SCRIPTS+=("$script") # Extract name from "# NAME:" (first occurrence) - SCRIPT_NAME=$(grep -m1 '^# NAME:' "$script" | cut -d':' -f2- | xargs) + SCRIPT_NAME=$(grep -m1 '^# NAME:' "$script" | sed 's/^# NAME:[[:space:]]*//') [ -z "$SCRIPT_NAME" ] && SCRIPT_NAME="$(basename "$script")" # Extract description from "# DESC:" (first occurrence) - SCRIPT_DESC=$(grep -m1 '^# DESC:' "$script" | cut -d':' -f2- | xargs) + SCRIPT_DESC=$(grep -m1 '^# DESC:' "$script" | sed 's/^# DESC:[[:space:]]*//') [ -z "$SCRIPT_DESC" ] && SCRIPT_DESC="No description available." NAMES+=("$SCRIPT_NAME") @@ -112,36 +113,18 @@ fi # Display menu dynamically echo "Available configurations:" for i in "${!SCRIPTS[@]}"; do - echo "$((i+1))) ${NAMES[i]}" + echo "$((i+1))) ${NAMES[i]} - ${DESCRIPTIONS[i]}" done -echo "$(( ${#SCRIPTS[@]} + 1 ))) Install ALL" -echo "$(( ${#SCRIPTS[@]} + 2 ))) Exit" +echo "$(( ${#SCRIPTS[@]} + 1 ))) Exit" # Get user input read -p "Select an option (1-${#SCRIPTS[@]}): " choice # Run selected script if (( choice >= 1 && choice <= ${#SCRIPTS[@]} )); then - echo "------------------------------" - echo " **${NAMES[choice-1]}**" - echo " ${DESCRIPTIONS[choice-1]}" - echo "------------------------------" - read -p "Proceed? (y/N) " confirm - if [[ "$confirm" =~ ^[Yy]$ ]]; then - bash "${SCRIPTS[choice-1]}" - else - echo "Cancelled." - fi + echo "Running: ${NAMES[choice-1]}" + bash "${SCRIPTS[choice-1]}" elif (( choice == ${#SCRIPTS[@]} + 1 )); then - echo "Running all scripts..." - for i in "${!SCRIPTS[@]}"; do - echo "------------------------------" - echo " **${NAMES[i]}**" - echo " ${DESCRIPTIONS[i]}" - echo "------------------------------" - bash "${SCRIPTS[i]}" - done -elif (( choice == ${#SCRIPTS[@]} + 2 )); then echo "Exiting..." exit 0 else @@ -149,4 +132,16 @@ else exit 1 fi +# Stage 2 Tasks +echo "Setting up user..." +read -p "Enter username: " NEW_USER +useradd -m -G wheel "$NEW_USER" +passwd "$NEW_USER" + +echo "Cleaning up installation files..." +rm -rf "$STAGE2_DIR" + +echo "Restoring TTY1 configuration..." +mv /mnt/target/etc/sv/agetty-tty1/conf.bak /mnt/target/etc/sv/agetty-tty1/conf >> $LOGFILE 2>&1 + bash --norc --noprofile