Added new scripts
This commit is contained in:
38
config-sample.json
Normal file
38
config-sample.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"audio": "pulseaudio",
|
||||
"bootloader": "systemd-bootctl",
|
||||
"desktop-environment": "i3",
|
||||
"dry-run": false,
|
||||
"gfx_driver": "VMware / VirtualBox (open-source)",
|
||||
"harddrives": [
|
||||
"/dev/vda"
|
||||
],
|
||||
"hostname": "archvm",
|
||||
"kernels": [
|
||||
"linux"
|
||||
],
|
||||
"keyboard-layout": "us",
|
||||
"mirror-region": {
|
||||
"Worldwide": {
|
||||
"https://mirror.rackspace.com/archlinux/$repo/os/$arch": true
|
||||
}
|
||||
},
|
||||
"nic": {
|
||||
"NetworkManager": true,
|
||||
"nic": "Use NetworkManager (necessary to configure internet graphically in GNOME and KDE)"
|
||||
},
|
||||
"ntp": true,
|
||||
"packages": [
|
||||
"docker",
|
||||
"git",
|
||||
"wget",
|
||||
"zsh",
|
||||
"neovim"
|
||||
],
|
||||
"profile": "/usr/lib/python3.10/site-packages/archinstall/profiles/desktop.py",
|
||||
"swap": true,
|
||||
"sys-encoding": "utf-8",
|
||||
"sys-language": "en_US",
|
||||
"timezone": "UTC",
|
||||
"version":"2.3.1"
|
||||
}
|
||||
@@ -20,7 +20,19 @@ echo "root:$1" | chpasswd
|
||||
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
# 4 finalize
|
||||
# configure network
|
||||
echo "[Match]" > /etc/systemd/network/20-wired.network
|
||||
echo "Name=enp1s0" >> /etc/systemd/network/20-wired.network
|
||||
echo "[Network]" >> /etc/systemd/network/20-wired.network
|
||||
echo "DHCP=yes" >> /etc/systemd/network/20-wired.network
|
||||
echo "DNS=1.1.1.1" >> /etc/systemd/network/20-wired.network
|
||||
# enable networkd
|
||||
systemctl enable systemd-networkd
|
||||
# enable resolved
|
||||
systemctl enable systemd-resolved
|
||||
|
||||
# curl the installation script
|
||||
curl $INSTALL_LOCATION/xabs.sh > /home/xabs.sh
|
||||
# cleanup
|
||||
rm /home/post-chroot.sh
|
||||
sh xabs.sh
|
||||
|
||||
2
xabs-install.sh
Executable file → Normal file
2
xabs-install.sh
Executable file → Normal file
@@ -108,7 +108,7 @@ mount $efipart /mnt/efi &> /dev/null
|
||||
# Refresh Arch keyrings.
|
||||
refreshkeys || error "Error automatically refreshing Arch keyring. Consider doing so manually."
|
||||
dialog --title "Installation" --infobox "\nInstalling of base packages. This might take a while..." 10 60
|
||||
pacstrap /mnt base linux linux-firmware dhclient grub efibootmgr >/dev/null 2>&1 || error "Error during installation of system, consider running pacstrap manually"
|
||||
pacstrap /mnt base linux linux-firmware dhclient grub efibootmgr neovim nano >/dev/null 2>&1 || error "Error during installation of system, consider running pacstrap manually"
|
||||
dialog --title "Installation" --infobox "\nSuccesful installation," 10 60
|
||||
# 3 Basic config
|
||||
# 3.1 fstab
|
||||
|
||||
73
xabs.sh
Executable file → Normal file
73
xabs.sh
Executable file → Normal file
@@ -1,51 +1,50 @@
|
||||
#!/bin/sh
|
||||
# Xavi's Script for lazy installs
|
||||
# License: MIT [FILL]
|
||||
#
|
||||
## OPTIONS ##
|
||||
usage() { printf "helping" && exit 1; }
|
||||
# heavily inspired on Luke's LARBS (lukesmith.xyz)
|
||||
|
||||
while getopts "nt" o; do case "${o}" in
|
||||
n) printf "user requested" && exit;;
|
||||
t) testmode= $true;;
|
||||
#*) printf "invalid option -%s\\n" "$OPTARG" && exit ;;
|
||||
*) usage;;
|
||||
esac done
|
||||
## FUNCTIONS ##
|
||||
welcomemsg() { \
|
||||
dialog --title "Welcome!" --msgbox "Welcome to Xavi's User Bootstrapping Script!\\n\\nThis script will automatically install a fully-featured Linux desktop, which I use as my main machine.\\n\\n-Luke" 10 60
|
||||
dialog --colors --title "Important Note!" --yes-label "All ready!" --no-label "Return..." --yesno "Be sure the computer you are using has current pacman updates and refreshed Arch keyrings.\\n\\nIf it does not, the installation of some programs might fail." 8 70
|
||||
}
|
||||
|
||||
installpkg(){
|
||||
if ["$testmode" = $true ];
|
||||
then
|
||||
echo "Installing" "$1"
|
||||
else
|
||||
echo "No test"
|
||||
# pacman --noconfirm --needed -S "$1" >/dev/null 2>&1 ;
|
||||
fi
|
||||
}
|
||||
getuserandpass() { \
|
||||
# Prompts user for new username an password.
|
||||
name=$(dialog --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
|
||||
while ! echo "$name" | grep -q "^[a-z_][a-z0-9_-]*$"; do
|
||||
name=$(dialog --no-cancel --inputbox "Username not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
done
|
||||
pass1=$(dialog --no-cancel --passwordbox "Enter a password for that user." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
pass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
while ! [ "$pass1" = "$pass2" ]; do
|
||||
unset pass2
|
||||
pass1=$(dialog --no-cancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
pass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
done ;}
|
||||
|
||||
# WTF is this line for??
|
||||
grepseq="\"^[PGA]*,\""
|
||||
usercheck() { \
|
||||
! { id -u "$name" >/dev/null 2>&1; } ||
|
||||
dialog --colors --title "WARNING!" --yes-label "CONTINUE" --no-label "No wait..." --yesno "The user \`$name\` already exists on this system. LARBS can install for a user already existing, but it will \\Zboverwrite\\Zn any conflicting settings/dotfiles on the user account.\\n\\nLARBS will \\Zbnot\\Zn overwrite your user files, documents, videos, etc., so don't worry about that, but only click <CONTINUE> if you don't mind your settings being overwritten.\\n\\nNote also that LARBS will change $name's password to the one you just gave." 14 70
|
||||
}
|
||||
|
||||
#error() {clear; printf "ERROR: \\n%s\\n" "$1"; exit;}
|
||||
preinstallmsg() { \
|
||||
dialog --title "Let's get this party started!" --yes-label "Let's go!" --no-label "No, nevermind!" --yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press <Let's go!> and the system will begin installation!" 13 60 || { clear; exit 1; }
|
||||
}
|
||||
## SCRIPT ##
|
||||
|
||||
welcomemsg(){
|
||||
dialog --title "Aloha!" --msgbox "hola" 10 60
|
||||
}
|
||||
|
||||
error() { printf "%s\n" "$1" >&2; exit 1; }
|
||||
|
||||
## SCRIPT START ##
|
||||
|
||||
# Check this is an Arch distro an we're root
|
||||
# Check if user is root on Arch distro. Install dialog.
|
||||
pacman --noconfirm --needed -Sy dialog || error "Are you sure you're running this as the root user, are on an Arch-based distribution and have an internet connection?"
|
||||
|
||||
# Start prompt
|
||||
welcomemsg || error "User exit."
|
||||
# Welcome user and pick dotfiles.
|
||||
welcomemsg || error "User exited."
|
||||
|
||||
# Check BOOT MODE
|
||||
# Get and verify username and password.
|
||||
getuserandpass || error "User exited."
|
||||
|
||||
# Give warning if user already exists.
|
||||
usercheck || error "User exited."
|
||||
|
||||
#installpkg dialog || error "Are you root and have an active internet connection?"
|
||||
# Welcome everyone!
|
||||
#welcomemsg || error "Exited"
|
||||
# Last chance for user to back out before install.
|
||||
preinstallmsg || error "User exited."
|
||||
|
||||
### The rest of the script requires no user input.
|
||||
|
||||
Reference in New Issue
Block a user