Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
|
51fbc1f2cf | |
|
0facbea16a | |
|
5aaacf72a0 | |
|
734d5b8332 |
|
@ -6,14 +6,13 @@ Use this to Deploy rices/set up services/etc.
|
|||
Each configuration script should follow this structure:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
# NAME: Your Script Name
|
||||
# DESC: A brief description of what the script does.
|
||||
|
||||
# Your script logic here
|
||||
```
|
||||
|
||||
If `# NAME:` is not found, install stage 2 will fall back to displaying the script's filename.
|
||||
If `# DESC:` is not found, "No description available." will be displayed instead.
|
||||
If NAME and DESC are not found, the script will default to the script's filename.
|
||||
|
||||
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.
|
|
@ -1 +1 @@
|
|||
i3wm.sh
|
||||
i3wm.sh
|
|
@ -210,12 +210,33 @@ xmirror
|
|||
#TODO: also remove CPU architecture
|
||||
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
|
||||
if grep "musl" <<< "$TARGET_TYPE"; then
|
||||
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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
# Stage 2 prefab environment/rice install scripts
|
||||
get_stage2_file "custom-scripts/scripts.lst"
|
||||
while read -r NEXT_SCRIPT; do
|
||||
[ -n "$NEXT_SCRIPT" ] && get_stage2_file "custom-scripts/$NEXT_SCRIPT"
|
||||
done < "$STAGE2_DIR/custom-scripts/scripts.lst"
|
||||
function download_scripts {
|
||||
local scripts_file="$1"
|
||||
|
||||
# Read the scripts file line by line
|
||||
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
|
||||
echo 'if [ -x /sbin/agetty -o -x /bin/agetty ]; then
|
||||
|
|
|
@ -118,13 +118,13 @@ done
|
|||
echo "$(( ${#SCRIPTS[@]} + 1 ))) Exit"
|
||||
|
||||
# Get user input
|
||||
read -p "Select an option [1-$((${#SCRIPTS[@]}+1))]: " CHOICE
|
||||
read -p "Select an option (1-${#SCRIPTS[@]}): " choice
|
||||
|
||||
# Run selected script
|
||||
if (( CHOICE >= 1 && CHOICE <= ${#SCRIPTS[@]} )); then
|
||||
echo "Running: ${NAMES[CHOICE-1]}"
|
||||
bash "${SCRIPTS[CHOICE-1]}"
|
||||
elif (( CHOICE == ${#SCRIPTS[@]} + 1 )); then
|
||||
if (( choice >= 1 && choice <= ${#SCRIPTS[@]} )); then
|
||||
echo "Running: ${NAMES[choice-1]}"
|
||||
bash "${SCRIPTS[choice-1]}"
|
||||
elif (( choice == ${#SCRIPTS[@]} + 1 )); then
|
||||
echo "Exiting..."
|
||||
exit 0
|
||||
else
|
||||
|
@ -140,6 +140,8 @@ 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
|
||||
|
|
Loading…
Reference in New Issue