basic installation covered
This commit is contained in:
3
install.sh
Normal file
3
install.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
curl 192.168.1.42/xabs-install.sh | sh
|
||||
|
||||
26
post-chroot.sh
Normal file
26
post-chroot.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# bash script to be runned on installation with chroot
|
||||
# takes as an argument the root password to be set
|
||||
INSTALL_LOCATION="192.168.1.42"
|
||||
|
||||
# 3.3 Time Zone
|
||||
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
|
||||
# 3.4 Localization
|
||||
echo "en_US.UTF8-8 UTF-8" >> /etc/locale.gen
|
||||
#locale-gen
|
||||
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
||||
# 3.5 Network config
|
||||
echo "$2" > /etc/hostname
|
||||
# 3.6 initramfs
|
||||
# this is not necesary
|
||||
# 3.7 root password
|
||||
echo "root:$1" | chpasswd
|
||||
#echo "set root password to $1"
|
||||
# 3.8 bootloader
|
||||
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
# 4 finalize
|
||||
# curl the installation script
|
||||
curl $INSTALL_LOCATION/xabs.sh > /home/xabs.sh
|
||||
# cleanup
|
||||
rm /home/post-chroot.sh
|
||||
119
xabs-install.sh
Executable file
119
xabs-install.sh
Executable file
@@ -0,0 +1,119 @@
|
||||
#!/bin/sh
|
||||
# this script tries to automate the setup process from live USB
|
||||
# once this script ends you should be able to reboot the computer and boot your
|
||||
# new Archlinux installation.
|
||||
|
||||
# It assumes you have already set up an internet connection (since you've been
|
||||
# able to download the script).
|
||||
|
||||
INSTALL_LOCATION="192.168.1.42"
|
||||
|
||||
welcomemsg(){
|
||||
dialog --title "XABS Installer!" --msgbox "\nWelcome to Xavi's Automated Bootstrap Script" 10 60
|
||||
|
||||
}
|
||||
|
||||
error() { printf "%s\n" "$1" >&2; exit 1; }
|
||||
|
||||
|
||||
refreshkeys() { \
|
||||
case "$(readlink -f /sbin/init)" in
|
||||
*systemd* )
|
||||
dialog --infobox "Refreshing Arch Keyring..." 4 40
|
||||
pacman --noconfirm -S archlinux-keyring >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
dialog --infobox "Enabling Arch Repositories..." 4 40
|
||||
pacman --noconfirm --needed -S artix-keyring artix-archlinux-support >/dev/null 2>&1
|
||||
for repo in extra community; do
|
||||
grep -q "^\[$repo\]" /etc/pacman.conf ||
|
||||
echo "[$repo]
|
||||
Include = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf
|
||||
done
|
||||
pacman -Sy >/dev/null 2>&1
|
||||
pacman-key --populate archlinux
|
||||
;;
|
||||
esac ;}
|
||||
|
||||
|
||||
getrootpass() { \
|
||||
# Prompts user for new username an password.
|
||||
rootpass1=$(dialog --no-cancel --passwordbox "Enter a password for the root user." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
rootpass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
while ! [ "$rootpass1" = "$rootpass2" ]; do
|
||||
unset rootpass2
|
||||
rootpass1=$(dialog --no-cancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
rootpass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
done ;}
|
||||
|
||||
|
||||
## SCRIPT START ##
|
||||
|
||||
# Check this is an Arch distro an we're root
|
||||
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."
|
||||
hostname=$(dialog --inputbox "First, please enter a name for your machine." 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
|
||||
getrootpass || error "User exit."
|
||||
# taken directly from the Archlinux Wiki
|
||||
|
||||
# 1.6 Check BOOT MODE
|
||||
# exits if bot mode wasn't EFI
|
||||
ls /sys/firmware/efi/efivars > /dev/null 2>&1 || error "Non EFI boot not yet supported."
|
||||
|
||||
# 1.7 Ignored (you should already have internet)
|
||||
|
||||
# 1.8 Update the system clock
|
||||
timedatectl set-ntp true
|
||||
|
||||
# 1.9 Partition the disks
|
||||
|
||||
# for now, this assumes full device install
|
||||
# first get the device name, ignore loop, rom and airoot. Remove lines that may
|
||||
# be caused by already partitioned drives
|
||||
disk=$(fdisk -l | grep "Disk" | egrep -v "identifier|type" | egrep -v "loop|rom|airoot" | cut -d ":" -f1 | cut -d " " -f2;)
|
||||
dialog --title "Partitioning" --infobox "\nPartitioning your disk $disk" 10 60
|
||||
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << FDISK_CMDS | fdisk $disk > /dev/null
|
||||
g # new GPT
|
||||
n # new partition
|
||||
1 #
|
||||
# default - first sector
|
||||
+512MiB # size
|
||||
n # new partition
|
||||
2 #
|
||||
# default - first sector
|
||||
# default - last sector
|
||||
t # partition type
|
||||
1 #
|
||||
uefi # uefi filesystem
|
||||
t # partition type
|
||||
2 #
|
||||
linux # linux filesystem
|
||||
w # write
|
||||
FDISK_CMDS
|
||||
dialog --title "Partitioning" --infobox "\n$disk succesfully partitioned. Starting format" 10 60
|
||||
# create names for the partitions
|
||||
part="${disk}2"
|
||||
efipart="${disk}1"
|
||||
# 1.10 format the partitions
|
||||
mkfs.fat -F 32 $efipart || error "Error formating EFI partition"
|
||||
mkfs.ext4 $part || error "Error formating linux partition"
|
||||
dialog --title "Format" --infobox "\nSuccesfully formated partitions" 10 60
|
||||
# 1.11 Mount the filesystems
|
||||
mount $part /mnt &> /dev/null
|
||||
mkdir /mnt/efi &> /dev/null
|
||||
mount $efipart /mnt/efi &> /dev/null
|
||||
# 2 Installation
|
||||
# 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"
|
||||
dialog --title "Installation" --infobox "\nSuccesful installation," 10 60
|
||||
# 3 Basic config
|
||||
# 3.1 fstab
|
||||
genfstab -U /mnt >> /mnt/etc/fstab
|
||||
# 3.2 chroot
|
||||
curl $INSTALL_LOCATION/post-chroot.sh > /mnt/home/post-chroot.sh
|
||||
curl $INSTALL_LOCATION/xabs.sh > /mnt/home/xabs.sh
|
||||
arch-chroot /mnt /home/post-chroot.sh $rootpass1 $hostname
|
||||
16
xabs.sh
16
xabs.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Xavi's Script for lazy installs
|
||||
# License: MIT
|
||||
# License: MIT [FILL]
|
||||
#
|
||||
## OPTIONS ##
|
||||
usage() { printf "helping" && exit 1; }
|
||||
@@ -32,8 +32,20 @@ welcomemsg(){
|
||||
dialog --title "Aloha!" --msgbox "hola" 10 60
|
||||
}
|
||||
|
||||
error() { printf "%s\n" "$1" >&2; exit 1; }
|
||||
|
||||
## SCRIPT START ##
|
||||
installpkg dialog || error "Are you root and have an active internet connection?"
|
||||
|
||||
# Check this is an Arch distro an we're root
|
||||
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."
|
||||
|
||||
# Check BOOT MODE
|
||||
|
||||
|
||||
#installpkg dialog || error "Are you root and have an active internet connection?"
|
||||
# Welcome everyone!
|
||||
#welcomemsg || error "Exited"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user