forked from BodgeMaster/void-usb
Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
3f10d03ad5 | |
|
517ac34e3d | |
|
2cc32fe645 |
|
@ -0,0 +1,19 @@
|
|||
|
||||
### Configuration Scripts
|
||||
|
||||
Use this to Deploy rices/set up services/etc.
|
||||
|
||||
Each configuration script should follow this structure:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env 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.
|
||||
|
||||
Place the scripts under this folder, add the filename to `scripts.lst` (separate by newline) and they will show up in the installer.
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
# NAME: Install i3wm
|
||||
# DESC: This script installs i3wm and basic utilities.
|
||||
|
||||
echo "Updating Void"
|
||||
xbps-install -Suv
|
||||
xbps-install -S
|
||||
|
||||
|
||||
echo -e "Installing i3wm"
|
||||
|
||||
xbps-install -S xinit xorg base-devel i3 i3status i3-gaps termite
|
|
@ -0,0 +1 @@
|
|||
i3wm.sh
|
|
@ -62,7 +62,7 @@ fi
|
|||
|
||||
echo "
|
||||
This script will now download and install Void Linux on your USB stick.
|
||||
Any data that is currently on the stick will be lost and it won’t be
|
||||
Any data that is currently on the stick will be lost and it won't be
|
||||
usable from Windows or MacOS.
|
||||
|
||||
Before we begin, the following packages need to be installed (if not installed already):
|
||||
|
@ -372,7 +372,7 @@ mkdir /mnt/target/boot/efi/LOADER >> $LOGFILE 2>&1
|
|||
echo "GRUB has been deliberately installed to a non-standard location.
|
||||
This avoids default kernel hooks breaking the custom config." > /mnt/target/boot/efi/LOADER/README.TXT
|
||||
|
||||
# no idea if any of these are even necessary/relevant but it can’t hurt...
|
||||
# no idea if any of these are even necessary/relevant but it can't hurt...
|
||||
TARGET_PRELOAD_GRUB_MODULES="usb usbms uhci ehci ohci part_gpt f2fs ahci ata pata"
|
||||
run_in_target grub-install --target=i386-pc --boot-directory=/boot/efi/LOADER --disk-module=native --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
|
||||
run_in_target grub-install --target=i386-efi --boot-directory=/boot/efi/LOADER --disk-module=native --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
|
||||
|
@ -411,26 +411,14 @@ 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
|
||||
|
||||
get_stage2_file package_selections/sections.lst
|
||||
readarray -t SECTIONS < "$STAGE2_DIR/package_selections/sections.lst"
|
||||
for I in ${!SECTIONS[@]}; do
|
||||
get_stage2_file "package_selections/${SECTIONS[$I]}/description.txt"
|
||||
|
||||
get_stage2_file "package_selections/${SECTIONS[$I]}/options.lst"
|
||||
readarray -t OPTIONS < "$STAGE2_DIR/package_selections/${SECTIONS[$I]}/options.lst"
|
||||
for J in ${!OPTIONS[@]}; do
|
||||
get_stage2_file "package_selections/${SECTIONS[$I]}/${OPTIONS[$J]}"
|
||||
done
|
||||
|
||||
get_stage2_file "package_selections/${SECTIONS[$I]}/additional_files.lst"
|
||||
readarray -t FILES < "$STAGE2_DIR/package_selections/${SECTIONS[$I]}/additional_files.lst"
|
||||
for J in ${!FILES[@]}; do
|
||||
get_stage2_file "package_selections/${SECTIONS[$I]}/${FILES[$J]}"
|
||||
done
|
||||
done
|
||||
# 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"
|
||||
|
||||
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
|
||||
|
|
|
@ -78,42 +78,68 @@ if [ "$INTERNET" = "up" ]; then
|
|||
echo "done"
|
||||
fi
|
||||
|
||||
readarray -t SECTIONS < /opt/void-usb/installer/package_selections/sections.lst
|
||||
for I in ${!SECTIONS[@]}; do
|
||||
readarray -t OPTIONS < "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/options.lst"
|
||||
AVAILABLE_OPTIONS=()
|
||||
for J in ${!OPTIONS[@]}; do
|
||||
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${OPTIONS[$J]}"
|
||||
if check; then
|
||||
AVAILABLE_OPTIONS+=("${OPTIONS[$J]}")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "${AVAILABLE_OPTIONS[1]}" ]; then
|
||||
# no need to ask, there is only one option anyway
|
||||
CHOICE="${AVAILABLE_OPTIONS[0]}"
|
||||
else
|
||||
clear
|
||||
cat "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/description.txt"
|
||||
echo ""
|
||||
for J in ${!AVAILABLE_OPTIONS[@]}; do
|
||||
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${AVAILABLE_OPTIONS[$J]}"
|
||||
echo "$J: $DESCRIPTION"
|
||||
done
|
||||
CHOICE=""
|
||||
while [ -z "$CHOICE" ]; do
|
||||
echo ""
|
||||
echo "Select by entering the corresponding number."
|
||||
read -p "> " CHOICE_NUMBER
|
||||
grep "^[0-9]*$" <<< "$CHOICE_NUMBER" && CHOICE="${AVAILABLE_OPTIONS[$CHOICE_NUMBER]}"
|
||||
done
|
||||
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=()
|
||||
|
||||
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/$CHOICE"
|
||||
if [ -n "$PACKAGES" ]; then
|
||||
xbps-install --yes $PACKAGES
|
||||
fi
|
||||
post_install
|
||||
# Find all scripts and extract their names & descriptions
|
||||
echo "Scanning for configuration scripts in $CONFIG_DIR..."
|
||||
for script in "$CONFIG_DIR"/*.sh; do
|
||||
[ -f "$script" ] || continue # Skip if no .sh files found
|
||||
SCRIPTS+=("$script")
|
||||
|
||||
# Extract name from "# NAME:" (first occurrence)
|
||||
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" | sed 's/^# DESC:[[:space:]]*//')
|
||||
[ -z "$SCRIPT_DESC" ] && SCRIPT_DESC="No description available."
|
||||
|
||||
NAMES+=("$SCRIPT_NAME")
|
||||
DESCRIPTIONS+=("$SCRIPT_DESC")
|
||||
done
|
||||
|
||||
# Check if no scripts were found
|
||||
if [ ${#SCRIPTS[@]} -eq 0 ]; then
|
||||
echo "No configuration scripts found in $CONFIG_DIR."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Display menu dynamically
|
||||
echo "Available configurations:"
|
||||
for i in "${!SCRIPTS[@]}"; do
|
||||
echo "$((i+1))) ${NAMES[i]} - ${DESCRIPTIONS[i]}"
|
||||
done
|
||||
echo "$(( ${#SCRIPTS[@]} + 1 ))) Exit"
|
||||
|
||||
# Get user input
|
||||
read -p "Select an option [1-$((${#SCRIPTS[@]}+1))]: " CHOICE
|
||||
|
||||
# Run selected script
|
||||
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
|
||||
echo "Invalid choice."
|
||||
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"
|
||||
mv /mnt/target/etc/sv/agetty-tty1/conf.bak /mnt/target/etc/sv/agetty-tty1/conf >> $LOGFILE 2>&1
|
||||
|
||||
bash --norc --noprofile
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
# Package Selections
|
||||
|
||||
These are intended to give the user a bunch of choices when installing the
|
||||
system. For example whether to use XFE or a more fully featured set of applications.
|
||||
|
||||
## Sections
|
||||
|
||||
Sections contain choices of a specific category. The sections are stored in
|
||||
folders containing the section’s description and its options.
|
||||
For each section, only one of the options can be chosen.
|
||||
The file `sections.lst` holds a list of all available sections in the order
|
||||
in which the user will be asked about them.
|
||||
|
||||
## Options
|
||||
|
||||
Options are shell scripts that are sourced by the stage 2 installer.
|
||||
They hold variables for description, package list, pre-install checks,
|
||||
and additional post-install actions.
|
||||
Options are shown in the order in which they appear in `options.lst`.
|
|
@ -1,3 +0,0 @@
|
|||
resources/common_packages
|
||||
resources/xinitrc
|
||||
resources/bashrc
|
|
@ -1 +0,0 @@
|
|||
Choose a desktop setup to install
|
|
@ -1,13 +0,0 @@
|
|||
function check {
|
||||
[ "$INTERNET" = "down" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
DESCRIPTION="Fully featured desktop with IceWM"
|
||||
|
||||
# TODO
|
||||
PACKAGES="$(cat /opt/void-usb/installer/package_selections/desktop/resources/common_packages) pavucontrol network-manager-applet vlc lxterminal bash-completion gufw conky icewm firefox arandr xscreensaver-elogind volctl"
|
||||
|
||||
function post_install {
|
||||
echo "desktop/icewm-light" >> /tmp/stage-2-choices
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
function check {
|
||||
[ "$INTERNET" = "down" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
DESCRIPTION="Small desktop with IceWM"
|
||||
|
||||
# TODO
|
||||
PACKAGES="$(cat /opt/void-usb/installer/package_selections/desktop/resources/common_packages) pulsemixer xterm icewm firefox htop xfe"
|
||||
|
||||
function post_install {
|
||||
echo "desktop/icewm-light" >> /tmp/stage-2-choices
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
function check {
|
||||
return 0
|
||||
}
|
||||
|
||||
DESCRIPTION="Leave the system as-is (no desktop)"
|
||||
|
||||
PACKAGES=""
|
||||
|
||||
function post_install {
|
||||
echo "desktop/none" >> /tmp/stage-2-choices
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
icewm-full
|
||||
icewm-lite
|
||||
none
|
|
@ -1,94 +0,0 @@
|
|||
# ALWAYS RUN
|
||||
# ==========
|
||||
# things to always set up, even for non-interactive shells
|
||||
|
||||
EDITOR=nano
|
||||
PAGER=less
|
||||
|
||||
if grep -F ".local/bin" <<< "$PATH"; then
|
||||
true
|
||||
else
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
export EDITOR PAGER PATH
|
||||
|
||||
# CHECK INTERACTIVE
|
||||
# =================
|
||||
# Don't do anything after this if not running an interactive shell.
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return ;;
|
||||
esac
|
||||
|
||||
# START XORG
|
||||
# ==========
|
||||
# TODO
|
||||
# check if login shell
|
||||
# if yes, check if .xinitrc exists
|
||||
# if yes, check if xorg is already running
|
||||
# if no, startx
|
||||
|
||||
# ALIASES
|
||||
# =======
|
||||
alias aliases="nano $HOME/.bashrc_aliases && source $HOME/.bashrc_aliases"
|
||||
[ -f $HOME/.bashrc_aliases ] && source $HOME/.bashrc_aliases
|
||||
|
||||
# BASH COMPLETION
|
||||
# ===============
|
||||
# include bash completions if they exist
|
||||
# (may need to be adjusted to where the bash completions are stored on the current system)
|
||||
|
||||
# Default for FreeBSD:
|
||||
if [ -f /usr/local/share/bash-completion/bash_completion.sh ]; then
|
||||
source /usr/local/share/bash-completion/bash_completion.sh
|
||||
# Default for Linux:
|
||||
elif [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
source /usr/share/bash-completion/bash_completion
|
||||
fi
|
||||
|
||||
# VARIABLES
|
||||
# =========
|
||||
|
||||
# don't put duplicate lines or lines starting with a space in history
|
||||
HISTCONTROL=ingnoreboth
|
||||
# unlimited history
|
||||
HISTSIZE=-1
|
||||
HISTFILESIZE=-1
|
||||
# set a fancy prompt
|
||||
PROMPT_COMMAND="PS1=\"[\[\e[03$(
|
||||
if [ $EUID -eq 0 ]
|
||||
then
|
||||
echo -n '1;02m'
|
||||
else
|
||||
if [ -n "$(groups | grep 'wheel\|sudo')" ];
|
||||
then
|
||||
echo -n '2;01m'
|
||||
else
|
||||
echo -n '6;01m'
|
||||
fi
|
||||
fi
|
||||
)\]\u@\h\[\e[0m\]]:\$(
|
||||
PROMPT_ERRORLEVEL=\$?
|
||||
if [ \$PROMPT_ERRORLEVEL -eq 0 ]
|
||||
then
|
||||
echo -n '\[\e[032;02m\]'
|
||||
else
|
||||
echo -n '\[\e[031;02m\]'
|
||||
fi
|
||||
echo -n \$PROMPT_ERRORLEVEL
|
||||
echo -n '\[\e[00m\]'
|
||||
):\[\e[034;01m\]\$(pwd)\[\e[0m\]:$(
|
||||
if [ $EUID -eq 0 ]
|
||||
then
|
||||
echo -n '\[\e[02m\]#\[\e[0m\]'
|
||||
else
|
||||
echo -n '\[\e[02m\]$\[\e[0m\]'
|
||||
fi
|
||||
)> \""
|
||||
|
||||
# SHELL OPTIONS
|
||||
# =============
|
||||
shopt -s histappend
|
||||
shopt -s checkwinsize
|
||||
shopt -s globstar
|
|
@ -1 +0,0 @@
|
|||
setxkbmap xauth xorg-video-drivers mesa mesa-dri xorg-server elogind xorg-input-drivers xrandr acpilight xhost xinit xrdb xinput xgamma xset iceauth sessreg transset xcmsdb xkbutils xmodmap dejavu-fonts-ttf elogind xdg-utils dbus-elogind dbus-elogind-libs dbus-elogind-x11 pipewire
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if grep -F ".local/bin" <<< "$PATH"; then
|
||||
true
|
||||
else
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
export PATH
|
||||
|
||||
if [ -d "$HOME/.xinitrc.d" ]; then
|
||||
for FILE in "$HOME/.xinitrc.d"/*; do
|
||||
[ -x "$FILE" ] && "$FILE" &
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# The line below is placed by the package selection script.
|
|
@ -1,10 +0,0 @@
|
|||
Do you want to install the proprietary Nvidia driver?
|
||||
|
||||
By default, Void Linux ships with the open-source nouveau driver.
|
||||
This is nice because it gets the system up and running when using an
|
||||
Nvidia GPU but, due to Nvidia’s secrecy, nouveau isn’t particularly good.
|
||||
|
||||
Installing the proprietary driver is recommended if you want to use Nvidia GPUs.
|
||||
This will enable the nonfree repository.
|
||||
|
||||
Different versions are available. You can only choose one.
|
|
@ -1,11 +0,0 @@
|
|||
function check {
|
||||
return 0
|
||||
}
|
||||
|
||||
DESCRIPTION="Don’t install."
|
||||
|
||||
PACKAGES=""
|
||||
|
||||
function post_install {
|
||||
echo "nvidia/none" >> /tmp/stage-2-choices
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
function check {
|
||||
[ "$INTERNET" = "down" ] && return 1
|
||||
if xbps-query glibc >/dev/null 2>&1; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
DESCRIPTION="Latest Nvidia driver, supports GTX ??? series and up"
|
||||
|
||||
#TODO: void-repo-nonfree
|
||||
PACKAGES="nvidia"
|
||||
|
||||
function post_install {
|
||||
#TODO: nvidia modeset kernel parameter?
|
||||
echo "nvidia/nvidia" >> /tmp/stage-2-choices
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
function check {
|
||||
[ "$INTERNET" = "down" ] && return 1
|
||||
if xbps-query glibc >/dev/null 2>&1; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
DESCRIPTION="Legacy Nvidia driver, version 390, supports GTX ??? series"
|
||||
|
||||
#TODO: void-repo-nonfree
|
||||
PACKAGES="nvidia390"
|
||||
|
||||
function post_install {
|
||||
#TODO: nvidia modeset kernel parameter?
|
||||
echo "nvidia/nvidia390" >> /tmp/stage-2-choices
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
function check {
|
||||
[ "$INTERNET" = "down" ] && return 1
|
||||
if xbps-query glibc >/dev/null 2>&1; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
DESCRIPTION="Legacy Nvidia driver, version 470, supports GTX ??? series"
|
||||
|
||||
#TODO: void-repo-nonfree
|
||||
PACKAGES="nvidia470"
|
||||
|
||||
function post_install {
|
||||
#TODO: nvidia modeset kernel parameter?
|
||||
echo "nvidia/nvidia470" >> /tmp/stage-2-choices
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
none
|
||||
nvidia
|
||||
nvidia470
|
||||
nvidia390
|
|
@ -1,2 +0,0 @@
|
|||
nvidia
|
||||
desktop
|
Loading…
Reference in New Issue