Compare commits

..

4 Commits

Author SHA1 Message Date
Joca 51fbc1f2cf
Add the ability to choose between different architectures 2025-02-21 14:19:48 -03:00
Joca 0facbea16a
Several Modifications
- Renamed Scripts to scripts.lst
- Script now restores tty configuration
- Removed xargs
- Removed install all option
2025-02-17 21:43:39 -03:00
Joca 5aaacf72a0
Add config scripts to install-stage2 and install-stage1 2025-01-28 22:25:56 -03:00
Joca 734d5b8332
Remove Package Selections, removed non-ascii
characters
2025-01-28 18:59:16 -03:00
4 changed files with 54 additions and 18 deletions

View File

@ -6,14 +6,13 @@ Use this to Deploy rices/set up services/etc.
Each configuration script should follow this structure: Each configuration script should follow this structure:
```bash ```bash
#!/usr/bin/env bash #!/bin/bash
# NAME: Your Script Name # NAME: Your Script Name
# DESC: A brief description of what the script does. # DESC: A brief description of what the script does.
# Your script logic here # Your script logic here
``` ```
If `# NAME:` is not found, install stage 2 will fall back to displaying the script's filename. If NAME and DESC are not found, the script will default to the script's filename.
If `# DESC:` is not found, "No description available." will be displayed instead.
Place the scripts under this folder, add the filename to `scripts.lst` (separate by newline) and they will show up in the installer. Place the scripts under this folder, add the filename to `scripts` (Separate by newline) and they will show up on the installer.

View File

@ -1 +1 @@
i3wm.sh i3wm.sh

View File

@ -210,12 +210,33 @@ xmirror
#TODO: also remove CPU architecture #TODO: also remove CPU architecture
TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)" TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)"
#TODO: select installation type
TARGET_TYPE="x86_64" options=("x86_64" "x86_64 musl" "x86_32")
while true; do
echo "Select your desired architecture."
for i in "${!options[@]}"; do
echo "$((i+1))) ${options[$i]}"
done
read -p "Input your choice: " choice
# Funny loop in bash...
if [[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 1 ] && [ "$choice" -le "${#options[@]}" ]; then
TARGET_TYPE="${options[$((choice-1))]}"
break
else
echo "Selection invalid."
fi
done
echo "You selected: $TARGET_TYPE"
#TODO: also add CPU architecture #TODO: also add CPU architecture
if grep "musl" <<< "$TARGET_TYPE"; then if grep "musl" <<< "$TARGET_TYPE"; then
TARGET_MIRROR="$TARGET_MIRROR/musl" TARGET_MIRROR="$TARGET_MIRROR/musl"
# Probably not the smartest idea, but since there is just one option for musl,
# I figured out this should do.
TARGET_TYPE="x86_64"
fi fi
echo -n "Copying repository keys... " echo -n "Copying repository keys... "
@ -411,14 +432,28 @@ function get_stage2_file {
wget --output-document="$STAGE2_DIR/$1" "$GIT_REPO_BASE/$1" >> $LOGFILE 2>&1 wget --output-document="$STAGE2_DIR/$1" "$GIT_REPO_BASE/$1" >> $LOGFILE 2>&1
} }
get_stage2_file "install-stage2.sh" >> $LOGFILE 2>&1 get_stage2_file install-stage2.sh >> $LOGFILE 2>&1
chmod 744 "$STAGE2_DIR/install-stage2.sh" >> $LOGFILE 2>&1 chmod 744 "$STAGE2_DIR/install-stage2.sh" >> $LOGFILE 2>&1
# Stage 2 prefab environment/rice install scripts function download_scripts {
get_stage2_file "custom-scripts/scripts.lst" local scripts_file="$1"
while read -r NEXT_SCRIPT; do
[ -n "$NEXT_SCRIPT" ] && get_stage2_file "custom-scripts/$NEXT_SCRIPT" # Read the scripts file line by line
done < "$STAGE2_DIR/custom-scripts/scripts.lst" while IFS= read -r script; do
# Call the function to download each script
get_stage2_file "custom-scripts/$script"
done < "$scripts_file"
}
# Create the custom-scripts directory
CUSTOM_SCRIPTS_DIR="$STAGE2_DIR/custom-scripts"
mkdir -p "$CUSTOM_SCRIPTS_DIR"
# Download the scripts file into the custom-scripts folder
SCRIPTS_FILE="scripts" # The name of the scripts file in the custom-scripts folder
get_stage2_file "custom-scripts/$SCRIPTS_FILE"
download_scripts "$CUSTOM_SCRIPTS_DIR/$SCRIPTS_FILE"
mv /mnt/target/etc/sv/agetty-tty1/conf /mnt/target/etc/sv/agetty-tty1/conf.bak >> $LOGFILE 2>&1 mv /mnt/target/etc/sv/agetty-tty1/conf /mnt/target/etc/sv/agetty-tty1/conf.bak >> $LOGFILE 2>&1
echo 'if [ -x /sbin/agetty -o -x /bin/agetty ]; then echo 'if [ -x /sbin/agetty -o -x /bin/agetty ]; then

View File

@ -118,13 +118,13 @@ done
echo "$(( ${#SCRIPTS[@]} + 1 ))) Exit" echo "$(( ${#SCRIPTS[@]} + 1 ))) Exit"
# Get user input # Get user input
read -p "Select an option [1-$((${#SCRIPTS[@]}+1))]: " CHOICE read -p "Select an option (1-${#SCRIPTS[@]}): " choice
# Run selected script # Run selected script
if (( CHOICE >= 1 && CHOICE <= ${#SCRIPTS[@]} )); then if (( choice >= 1 && choice <= ${#SCRIPTS[@]} )); then
echo "Running: ${NAMES[CHOICE-1]}" echo "Running: ${NAMES[choice-1]}"
bash "${SCRIPTS[CHOICE-1]}" bash "${SCRIPTS[choice-1]}"
elif (( CHOICE == ${#SCRIPTS[@]} + 1 )); then elif (( choice == ${#SCRIPTS[@]} + 1 )); then
echo "Exiting..." echo "Exiting..."
exit 0 exit 0
else else
@ -140,6 +140,8 @@ passwd "$NEW_USER"
echo "Cleaning up installation files..." echo "Cleaning up installation files..."
rm -rf "$STAGE2_DIR" 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 mv /mnt/target/etc/sv/agetty-tty1/conf.bak /mnt/target/etc/sv/agetty-tty1/conf >> $LOGFILE 2>&1
bash --norc --noprofile bash --norc --noprofile