diff --git a/sh/install/002-partitions b/scripts/arch/001-preinstall similarity index 50% rename from sh/install/002-partitions rename to scripts/arch/001-preinstall index 461ba1a8..aaec1d6a 100644 --- a/sh/install/002-partitions +++ b/scripts/arch/001-preinstall @@ -1,17 +1,18 @@ #!/bin/sh # -# Make a DOS partition table with one primary ext4 partition and -# enable boot for it. Then, create a primary swap partition with -# the remaining disk space. -# -# For example, if your hard drive is 512GB then you'd allocate -# just under that for the ext4 partition and the remaining GB to -# swap, depending on how much you think you'll need. +# This script assumes you already have an active internet connection +# (preferably through Ethernet). # # https://wiki.archlinux.org/index.php/Installation_guide set -xe +# Sync the time with one online before doing anything +timedatectl set-ntp true + +# Make a DOS partition table with one primary ext4 partition and +# enable boot for it. Then, create a primary swap partition with +# the remaining disk space. parted /dev/sda mklabel msdos parted /dev/sda mkpart primary ext4 1MiB 60GiB @@ -19,3 +20,14 @@ parted /dev/sda mkpart primary ext4 1MiB 60GiB parted /dev/sda set 1 boot on parted /dev/sda mkpart primary linux-swap 60GiB 100% + +# Format sda1 with ext4 and sda2 with swap +mkfs -t ext4 /dev/sda1 + +mkswap /dev/sda2 + +# Enable the swap partition +swapon /dev/sda2 + +# Mount the newly created file system (/dev/sda1) to /mnt. +mount /dev/sda1 /mnt diff --git a/sh/install/005-pacstrap b/scripts/arch/002-install similarity index 100% rename from sh/install/005-pacstrap rename to scripts/arch/002-install diff --git a/scripts/arch/003-configure b/scripts/arch/003-configure new file mode 100644 index 00000000..c11a3f6f --- /dev/null +++ b/scripts/arch/003-configure @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Once this script finishes, change the root password with passwd, +# then unmount /mnt (with umount) and restart the system. +# +# https://wiki.archlinux.org/index.php/Installation_guide + +set -xe + +$HOSTNAME = "arch" + +# Generate the fstab file (so the filesystem is mounted on boot) +genfstab -U /mnt > /mnt/etc/fstab + +# Set the timezone +arch-chroot /mnt ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime + +# Generate /etc/adjtime +arch-chroot /mnt hwclock --systohc + +# Set the hostname +echo "$HOSTNAME" > /mnt/etc/hostname + +# Configure the hosts file (if your system has a permanent IP address, use that instead of 127.0.1.1) +echo "127.0.0.1 localhost" >> /mnt/etc/hosts +echo "::1 localhost" >> /mnt/etc/hosts +echo "127.0.1.1 $HOSTNAME.localdomain $HOSTNAME" >> /mnt/etc/hosts + +# Set the language to English and use the en_US.UTF-8 locale. +echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf +echo "en_US.UTF-8 UTF-8" > /mnt/etc/locale.gen + +# Generate the locale. +arch-chroot /mnt locale-gen + +# Explicitly set the keymap to US. +echo "KEYMAP=us" > /mnt/etc/vconsole.conf + +# Change the terminal font to a larger one (`latarcyrheb-sun32` is also an option) +echo "FONT=ter-132n" >> /mnt/etc/vconsole.conf + +# Install grub to the primary partition. +arch-chroot /mnt grub-install /dev/sda + +# Prevent the GRUB window from showing at boot, ideal for single OS machines (undo with chroot and mkconfig) +sed -i '/GRUB_TIMEOUT/c\GRUB_TIMEOUT=0' /mnt/etc/default/grub + +# This should make the startup process not output anything (not tested) +sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/c\GRUB_CMDLINE_LINUX_DEFAULT="quiet show_status=0 rd.udev.log-priority=3 loglevel=3"' /mnt/etc/default/grub + +# Make the configuration file for grub. +arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg + +# Change the shell of the root account to fish. +arch-chroot /mnt chsh -s /usr/bin/fish + +# Save our hardware information with mkinitcpio. This creates +# an initial ramdisk environment that allows us to boot the +# Linux kernel. +arch-chroot /mnt mkinitcpio -p linux diff --git a/scripts/arch/004-postinstall b/scripts/arch/004-postinstall new file mode 100644 index 00000000..77f23ad9 --- /dev/null +++ b/scripts/arch/004-postinstall @@ -0,0 +1,39 @@ +#!/bin/sh +# +# Common post-install system configuration that doesn't involve any +# external packages (besides fish) +# +# https://wiki.archlinux.org/index.php/General_recommendations + +set -xe + +$USERNAME = "hello" + +# Start and enable the DHCP client daemon service +systemctl start dhcpcd.service +systemctl enable dhcpcd.service + +# Set the timezone with systemd, and sync it periodically with a remote server +timedatectl set-timezone America/New_York +timedatectl set-ntp true + +# Font settings (https://old.reddit.com/r/archlinux/comments/5r5ep8) +ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d # Disable embedded bitmaps for all fonts +ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d # Enable sub-pixel RGB rendering +ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d # Enable the LCD filter (reduces color fringing) + +# Change the systemd wait time from 90s to 30s, mitigating a potential hang at shutdown +echo "DefaultTimeoutStartSec=30s" >> /etc/systemd/system.conf +echo "DefaultTimeoutStopSec=30s" >> /etc/systemd/system.conf + +# Enable colors in pacman by uncommenting the Color line. +sed -i '/Color/s/^#//g' /etc/pacman.conf + +# Give users in the wheel group permission to use sudo +echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers + +# Create a new user account with sudo privileges and the fish shell. +arch-chroot /mnt useradd -m -g users -G wheel -s /usr/bin/fish $USERNAME + +# Then, set the password equal to the username (change this later). +echo "$USERNAME:$USERNAME" | chpasswd diff --git a/sh/install/001-checks b/sh/install/001-checks deleted file mode 100644 index e4f2b421..00000000 --- a/sh/install/001-checks +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# Sync the time with one online so we have the proper -# time before doing anything. Make sure you're connected -# to the internet first. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -timedatectl set-ntp true diff --git a/sh/install/003-format b/sh/install/003-format deleted file mode 100644 index f4a1c042..00000000 --- a/sh/install/003-format +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# Format sda1 with an ext4 partition and sda2 with a swap partition. -# Then, enable swap for sda2. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -mkfs -t ext4 /dev/sda1 - -mkswap /dev/sda2 - -swapon /dev/sda2 diff --git a/sh/install/004-mount b/sh/install/004-mount deleted file mode 100644 index f65c9af2..00000000 --- a/sh/install/004-mount +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -# Mount the newly created filesystem (/dev/sda1) to /mnt. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -mount /dev/sda1 /mnt diff --git a/sh/install/006-fstab b/sh/install/006-fstab deleted file mode 100644 index cbbf6938..00000000 --- a/sh/install/006-fstab +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# Generate the fstab file so that the filesystem is -# automatically mounted on boot. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -genfstab -U /mnt > /mnt/etc/fstab diff --git a/sh/install/011-hwclock b/sh/install/011-hwclock deleted file mode 100644 index 7e3b39bb..00000000 --- a/sh/install/011-hwclock +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# -# Set your timezone and update the hardware clock, assuming -# it is currently set to UTC. Note that if you want to use -# multiple operating systems on the same hardware, you -# shouldn't do this. -# -# Check whether or not your hardware clock (RTC) is localtime: -# timedatectl | grep local -# -# Change hardware clock to localtime: -# timedatectl set-local-rtc 1 -# -# Change hardware clock back to UTC: -# timedatectl set-local-rtc 0 -# -# Note that RTC (the hardware clock) stands for "Real Time Clock" -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -arch-chroot /mnt ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime - -arch-chroot /mnt hwclock --systohc diff --git a/sh/install/012-hostname b/sh/install/012-hostname deleted file mode 100644 index 6b6c49b2..00000000 --- a/sh/install/012-hostname +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# -# Set the hostname in all the necessary places. -# -# Note that if your system has a permanent IP address, that -# should be used instead of 127.0.0.1. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -$HOSTNAME = "arch" - -echo "$HOSTNAME" > /mnt/etc/hostname -echo "127.0.1.1 $HOSTNAME.localdomain $HOSTNAME" >> /mnt/etc/hosts - diff --git a/sh/install/013-localization b/sh/install/013-localization deleted file mode 100644 index 5209c3fb..00000000 --- a/sh/install/013-localization +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# Set the language to English and use the en_US.UTF-8 locale. -# Then, generate it. -# -# Next, explicitly set the keymap to US. -# -# Note that we also change the terminal font to a bigger one -# (terminus-font) since this setting also uses vconsole.conf. -# Use `latarcyrheb-sun32` if you want to use the default -# terminal font instead. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf -echo "en_US.UTF-8 UTF-8" > /mnt/etc/locale.gen - -arch-chroot /mnt locale-gen - -echo "KEYMAP=us" > /mnt/etc/vconsole.conf -echo "FONT=ter-132n" >> /mnt/etc/vconsole.conf diff --git a/sh/install/014-systemd b/sh/install/014-systemd deleted file mode 100644 index d3d3ef6d..00000000 --- a/sh/install/014-systemd +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# Change the systemd wait time from 90s to 10s, preventing the -# system from hanging at shutdown. -# -# https://unix.stackexchange.com/questions/273876 -# https://old.reddit.com/r/archlinux/comments/4bawf7 - -set -xe - -SYSTEMD="/mnt/etc/systemd/system.conf" - -echo "DefaultTimeoutStartSec=10s" >> $SYSTEMD -echo "DefaultTimeoutStopSec=10s" >> $SYSTEMD diff --git a/sh/install/015-pacman b/sh/install/015-pacman deleted file mode 100644 index a2d708cd..00000000 --- a/sh/install/015-pacman +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# Enable colors in pacman by uncommenting the Color line. -# -# https://wiki.archlinux.org/index.php/Color_output_in_console#pacman - -set -xe - -PACMAN="/mnt/etc/pacman.conf" - -sed -i '/Color/s/^#//g' $PACMAN diff --git a/sh/install/021-sudo b/sh/install/021-sudo deleted file mode 100644 index ddb688f6..00000000 --- a/sh/install/021-sudo +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -# Give the wheel group permission to use the sudo and su commands. -# -# https://wiki.archlinux.org/index.php/Sudo - -set -xe - -echo "%wheel ALL=(ALL) ALL" >> /mnt/etc/sudoers diff --git a/sh/install/022-grub b/sh/install/022-grub deleted file mode 100644 index 16cc9098..00000000 --- a/sh/install/022-grub +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Install grub to the primary partition. Then, make the -# configuration file for grub. -# -# https://wiki.archlinux.org/index.php/Grub - -set -xe - -arch-chroot /mnt grub-install /dev/sda - -# This should work, since /etc/default/grub should exist after -# installing the grub package with pacman, although it hasn't -# been tested yet. This prevents the GRUB window from showing -# at boot, which is ideal for single operating system machines. -# -# In the future, if you need to use grub, simply chroot into -# your system, edit the config file, and grub-mkconfig once more. -sed -i '/GRUB_TIMEOUT/c\GRUB_TIMEOUT=0' /etc/default/grub - -arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg diff --git a/sh/install/023-mkinitcpio b/sh/install/023-mkinitcpio deleted file mode 100644 index 716a5d56..00000000 --- a/sh/install/023-mkinitcpio +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# Save our hardware information with mkinitcpio. This creates -# an initial ramdisk environment that allows us to boot the -# Linux kernel. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -arch-chroot /mnt mkinitcpio -p linux diff --git a/sh/install/024-chsh b/sh/install/024-chsh deleted file mode 100644 index 6ba3fe7d..00000000 --- a/sh/install/024-chsh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# -# Change the shell of the root account to fish. -# -# https://wiki.archlinux.org/index.php/Command-line_shell - -arch-chroot /mnt chsh -s /usr/bin/fish diff --git a/sh/install/025-user b/sh/install/025-user deleted file mode 100644 index ccd29fa2..00000000 --- a/sh/install/025-user +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# Create a new user account with sudo privileges and the fish shell. -# Then, and add a password to it. -# -# Note that the default password will be the same as your username. -# -# To change the root password, use passwd. -# To change the new user's password, use passwd . -# -# https://wiki.archlinux.org/index.php/Password - -set -xe - -$USERNAME = "hello" - -arch-chroot /mnt useradd -m -g users -G wheel -s /usr/bin/fish $USERNAME - -# This is a workaround to the problem of using pipes with arch-chroot -echo "echo $USERNAME:$USERNAME | chpasswd" > /mnt/root/chpasswd.sh -chmod +x /mnt/root/chpasswd.sh -arch-chroot /mnt /root/chpasswd.sh -rm /mnt/root/chpasswd.sh diff --git a/sh/install/026-cleanup b/sh/install/026-cleanup deleted file mode 100644 index da49c66d..00000000 --- a/sh/install/026-cleanup +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# The installation process is done. Unmount the filesystem and -# restart the computer in order to boot into the new system. -# -# Alternatively, you can perform more operations with chroot -# before you unmount and reboot. -# -# https://wiki.archlinux.org/index.php/Installation_guide - -set -xe - -umount /mnt - -reboot