Compare commits

..

No commits in common. "master" and "bootable" have entirely different histories.

25 changed files with 49 additions and 296 deletions
checks
flavours
cpu.flavour
i3.flavour
mate.flavour
networkmanager.flavour
sound.flavour
ssh.flavour
sudo.flavour
swapfile.flavour
unsplash.flavour
user.flavour
virtualbox-guest.flavour
wifi-menu.flavour
xorg.flavour
yaourt.flavour
install.sh
steps

@ -4,9 +4,9 @@ ping -c 1 archlinux.org 2>/tmp/arch-maride-flavour_checks_internet_error.log 1>/
return=$? return=$?
if [ "$return" -eq 0 ]; then if [ "$return" -eq 0 ]; then
amf_return=0 exit 0
else else
echo "~> Either internet is unavailable or archlinux.org is down..." echo "~> Either internet is unavailable or archlinux.org is down..."
echo "~> (ping returned $return. Maybe check the logs in /tmp." echo "~> (ping returned $return. Maybe check the logs in /tmp."
amf_return=1 exit 1
fi fi

@ -1,21 +0,0 @@
#!/bin/bash
amf_return=0
echo " We can force to fetch PGP keys via HTTP over 80/tcp."
echo " You probably don't want this unless your internet connection is heavily filtered."
echo -n "=> Is your internet connection filtered (e.g. company network)? (y/N)"
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
echo " Ugh. Poor bastard, you."
keyserver="hkp://p80.pool.sks-keyservers.net:80"
else
keyserver="hkp://pool.sks-keyservers.net"
fi
echo " Fetching via $keyserver"
dirmngr &
pacman-key --populate --keyserver $keyserver || amf_return=1
pacman-key --refresh-keys --keyserver $keyserver || amf_return=1

@ -1,16 +1,11 @@
#!/bin/sh #!/bin/sh
if [ "$bootloader" == "BIOS" ]; then ls /sys/firmware/efi/efivars 2>/tmp/arch-maride-flavour_checks_uefi_error.log 1>/tmp/arch-maride-flavour_checks_uefi_out.log
echo "~> Not an EFI host, not checking for EFI." return=$?
amf_return=0
else
ls /sys/firmware/efi/efivars 2>/tmp/arch-maride-flavour_checks_uefi_error.log 1>/tmp/arch-maride-flavour_checks_uefi_out.log
return=$?
if [ "$return" -eq 0 ]; then if [ "$return" -eq 0 ]; then
amf_return=0 exit 0
else else
echo "~> This doesn't seem to be an UEFI boot. Please boot UEFI." echo "~> This doesn't seem to be an UEFI boot. Please boot UEFI."
amf_return=1 exit 1
fi
fi fi

@ -1,10 +0,0 @@
#!/bin/sh
echo "~> Installing thermald cpupower"
pacstrap /mnt thermald cpupower
echo " Setting 'ondemand' governor"
arch-chroot /mnt cpupower frequency-set -g ondemand
echo " Start cpupower on boot"
arch-chroot /mnt systemctl enable cpupower
amf_return=0

@ -1,18 +0,0 @@
#!/bin/sh
echo "~> Installing i3"
pacstrap /mnt i3 feh compton dmenu acpi
user=$(ls /mnt/home)
if [ "$user" == "" ]; then
path="/mnt/etc/skel/"
else
path="/mnt/home/$user/"
fi
echo "~> Creating .xinitrc"
echo "compton -CGb" > $path/.xinitrc
echo "feh --bg-fill /etc/wallpapers/\$(ls /etc/wallpapers/ | shuf -n 1)" >> $path/.xinitrc
echo "exec i3" >> $path/.xinitrc
amf_return=0

@ -1,16 +0,0 @@
#!/bin/sh
echo "~> Installing mate"
pacstrap /mnt mate mate-extra
user=$(ls /mnt/home)
if [ "$user" == "" ]; then
path="/mnt/etc/skel/"
else
path="/mnt/home/$user/"
fi
echo "~> Creating .xinitrc"
echo "exec mate-session" > $path/.xinitrc
amf_return=0

@ -1,8 +0,0 @@
#!/bin/sh
echo "~> Installing NetworkManager"
pacstrap /mnt networkmanager
echo " Enabling NetworkManager on boot"
arch-chroot /mnt systemctl enable NetworkManager
amf_return=0

@ -1,6 +0,0 @@
#!/bin/sh
echo "~> Installing pulseaudio alsa-utils ponymix"
pacstrap /mnt pulseaudio alsa-utils ponymix
amf_return=0

@ -1,14 +0,0 @@
#!/bin/sh
echo "~> Install openssh package"
pacstrap /mnt openssh
echo "~> Patch /etc/ssh/sshd_config...:"
echo " * disallow passwords."
arch-chroot /mnt sed -i "s/^#PasswordAuthentication .*$/PasswordAuthentication no/g" /etc/ssh/sshd_config
echo " * force SSH keys."
arch-chroot /mnt sed -i "s/^#PubkeyAuthentication .*$/PubkeyAuthentication yes/g" /etc/ssh/sshd_config
echo " * enable on boot."
arch-chroot /mnt systemctl enable sshd
amf_return=0

@ -1,10 +0,0 @@
#!/bin/sh
echo "~> Install sudo package"
pacstrap /mnt sudo
echo "~> Create group sudo and patch sudoers file"
arch-chroot /mnt groupadd sudo
arch-chroot /mnt sed -i "s/^# %sudo/%sudo/g" /etc/sudoers
amf_return=0

@ -1,10 +0,0 @@
#!/bin/sh
echo "~> Installing systemd-swap"
pacstrap /mnt systemd-swap
echo " Patching swap.conf"
arch-chroot /mnt sed -i "s/\$swapfu_enabled=0/swapfu_enabled=1/g" /etc/systemd/swap.conf
echo " Enabling systemd-swap on boot"
arch-chroot /mnt systemctl enable systemd-swap
amf_return=0

@ -1,11 +0,0 @@
#!/bin/sh
echo "~> Grabbing a random image from unsplash.com..."
mkdir -p /mnt/etc/wallpapers/
for tag in {forest,ocean,sky,snow,architecture,technology,stars,hills,nature,fields,trees,night}; do
wget $(curl https://unsplash.com/search/photos/$tag | grep -oE 'content="http://images.unsplash.com/photo-([a-zA-Z0-9_\\-]*)' | sed -e 's/content="//g' | shuf -n 1) -O /mnt/etc/wallpapers/$tag-$(uuidgen).jpg
done
amf_return=0

@ -1,37 +0,0 @@
#!/bin/sh
echo "~> Changing password for root account."
arch-chroot /mnt passwd root
echo -n "~> Do you want to create an user account? (Y/n) "
read answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
amf_return=0
else
echo -n " Name of your new user? "
read name
export username=$name
arch-chroot /mnt useradd -m $name
arch-chroot /mnt passwd $name
# If group "sudo" exists (=> sudo.flavour was installed), ask if the user should be added
if [ $(arch-chroot /mnt getent group sudo) ]; then
echo -n "~> Do you want to add $name to sudoers? (Y/n) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
arch-chroot /mnt usermod -a -G sudo $name
fi
fi
echo -n " Set up zsh with ohmyzsh for $name? (Y/n) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
pacstrap /mnt zsh git
arch-chroot /mnt git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git /home/$name/.oh-my-zsh
wget https://git.darknebu.la/maride/config/raw/master/zshrc -O /mnt/home/$name/.zshrc
arch-chroot /mnt chsh -s /bin/zsh $name
fi
amf_return=0
fi

@ -1,6 +0,0 @@
#!/bin/sh
echo "~> Installing packages to be a virtualbox guest"
pacstrap /mnt virtualbox-guest-utils virtualbox-guest-modules-arch
amf_return=0

@ -1,5 +0,0 @@
#!/bin/sh
pacstrap /mnt dialog wpa_supplicant
amf_return=0

@ -1,5 +0,0 @@
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "de"
EndSection

@ -1,7 +0,0 @@
#!/bin/sh
pacstrap /mnt xorg xorg-xinit xterm ttf-dejavu
cp 00-keyboard.conf /mnt/etc/X11/xorg.conf.d/
amf_return=0

@ -1,8 +0,0 @@
#!/bin/sh
pacstrap /mnt git
arch-chroot /mnt git clone https://aur.archlinux.org/package-query.git /tmp/package-query && cd /tmp/package-query && makepkg -si
arch-chroot /mnt git clone https://aur.archlinux.org/yaourt.git /tmp/yaourt && cd /tmp/yaourt && makepkg -si
arch-chroot /mnt rm -R /tmp/package-query /tmp/yaourt
amf_return=0

@ -11,20 +11,11 @@ echo " * An internet connection (DHCP or static, idc...)"
echo -n "=> Did you set that up? (y/N) " echo -n "=> Did you set that up? (y/N) "
read answer read answer
if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then if [ "$answer" != "y" ]; then
echo "OK, then do necessary steps and see you soon." echo "OK, then do necessary steps and see you soon."
exit 1 exit 1
fi fi
echo -n "=> Do you want to install on EFI or BIOS? BIOS is required for VirtalBox hosts (E/b) "
read answer
if [ "$answer" != "e" ] && [ "$answer" != "E" ]; then
export bootloader="BIOS";
else
export bootloader="EFI";
fi
echo "=> Please enter the full path to the block device the installation should take place on: (e.g. /dev/sda)" echo "=> Please enter the full path to the block device the installation should take place on: (e.g. /dev/sda)"
echo " Make sure to choose a drive, not a partition." echo " Make sure to choose a drive, not a partition."
echo " Hint: here's a list of devices that may be the right:" echo " Hint: here's a list of devices that may be the right:"
@ -36,8 +27,9 @@ export blockdevice
for check in checks/*.check for check in checks/*.check
do do
echo "=> Running check '$check'..." echo "=> Running check '$check'..."
source $check $check
if [ "$amf_return" -ne 0 ]; then return=$?
if [ "$return" -ne 0 ]; then
echo "=> Check failed. Fix it, maybe." echo "=> Check failed. Fix it, maybe."
exit exit
fi fi
@ -46,45 +38,10 @@ done
for step in steps/*.step for step in steps/*.step
do do
echo "=> Running step '$step'..." echo "=> Running step '$step'..."
source $step $step
if [ "$amf_return" -ne 0 ]; then return=$?
if [ "$return" -ne 0 ]; then
echo "=> Step failed. That is weird. Sorry. Check logs maybe." echo "=> Step failed. That is weird. Sorry. Check logs maybe."
exit exit
fi fi
done done
for flavour in flavours/*.flavour
do
# in any case, run it once
rerun=1
while [ $rerun -eq 1 ]; do
echo -n "=> Do you want to run flavour '$flavour'? (y/N) "
read answer
rerun=0;
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
echo "=> Running flavour '$flavour'..."
pushd $flavour
source ./install.sh
if [ "$amf_return" -ne 0 ]; then
echo "=> Flavour failed. :( Rerun? (Y/n) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then
rerun=1;
fi
fi
popd
fi
done
done
echo -n "=> Finished \o/ reboot now? (Y/n) "
read answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
exit
fi
reboot

@ -4,17 +4,17 @@ echo "~> Going to wipe $blockdevice. Just skip it if you are really sure that th
echo -n "~> Wipe block device? (Y/n) " echo -n "~> Wipe block device? (Y/n) "
read answer read answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then if [ "$answer" == "n" ]; then
amf_return=0 exit 0
else fi
echo -n "~> You sure? (y/N) "
read answer
if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then echo -n "~> You sure? (y/N) "
read answer
if [ "$answer" == "y" ]; then
echo "~> OK. Be patient now, that could take some time..." echo "~> OK. Be patient now, that could take some time..."
dd if=/dev/zero of=$blockdevice status=progress dd if=/dev/zero of=$blockdevice status=progress
amf_return=0 exit 0
else else
amf_return=1 exit 1
fi
fi fi

@ -8,8 +8,8 @@ echo -e "g\nn\n1\n2048\n+300M\nn\n2\n\n\np\nw" | fdisk $blockdevice
if [ "$?" -eq 0 ]; then if [ "$?" -eq 0 ]; then
echo "~> Seems to have worked. Yay!" echo "~> Seems to have worked. Yay!"
amf_return=0 exit 0
else else
echo "~> Failed. :(" echo "~> Failed. :("
amf_return=1 exit 1
fi fi

@ -6,10 +6,9 @@ mkfs.fat -F32 ${blockdevice}1
echo -n "~> Do you want to encrypt root? (Y/n) " echo -n "~> Do you want to encrypt root? (Y/n) "
read answer read answer
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then if [ "$answer" == "n" ]; then
echo "~> There are close to no reasons to not do this, but hey, you're an adult." echo "~> There are close to no reasons to not do this, but hey, you're an adult."
rootformat=${blockdevice}2 rootformat=${blockdevice}2
didCrypt=0
else else
echo "~> Formatting root (/) for crypto" echo "~> Formatting root (/) for crypto"
cryptsetup -v luksFormat ${blockdevice}2 cryptsetup -v luksFormat ${blockdevice}2
@ -18,7 +17,6 @@ else
echo "~> Open the crypt container" echo "~> Open the crypt container"
cryptsetup luksOpen ${blockdevice}2 cryptroot cryptsetup luksOpen ${blockdevice}2 cryptroot
rootformat=/dev/mapper/cryptroot rootformat=/dev/mapper/cryptroot
didCrypt=1
fi fi
echo "~> Formatting $rootformat EXT4" echo "~> Formatting $rootformat EXT4"
@ -28,5 +26,3 @@ echo "~> Mount partitions"
mount $rootformat /mnt mount $rootformat /mnt
mkdir -p /mnt/boot mkdir -p /mnt/boot
mount ${blockdevice}1 /mnt/boot mount ${blockdevice}1 /mnt/boot
amf_return=0

@ -2,5 +2,3 @@
echo "~> Installing 'base' group and 'grub', 'efibootmgr'" echo "~> Installing 'base' group and 'grub', 'efibootmgr'"
pacstrap /mnt base grub efibootmgr pacstrap /mnt base grub efibootmgr
amf_return=0

@ -17,19 +17,9 @@ echo -e "~> Choose a hostname: "
read hostname read hostname
echo $hostname > /mnt/etc/hostname echo $hostname > /mnt/etc/hostname
echo "~> Configuring 'grub' for $bootloader" echo "~> Configuring 'grub'"
if [ "$bootloader" == "EFI" ]; then arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch_GRUB
arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=BOOT echo "GRUB_CMDLINE_LINUX='cryptdevice=UUID=`blkid -o value ${blockdevice}2 | head -n 1`:cryptroot'" > /mnt/etc/default/grub
# thanks to Virtualbox, this step is necessary
cp /mnt/boot/EFI/BOOT/{grubx64.efi,BOOTX64.EFI}
else
arch-chroot /mnt grub-install --target=i386-pc /dev/*da
fi
if [ "$didCrypt" -eq 1 ]; then
echo "GRUB_CMDLINE_LINUX='cryptdevice=UUID=`blkid -o value ${blockdevice}2 | head -n 1`:cryptroot'" > /mnt/etc/default/grub
fi
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
echo "~> Patching mkinitcpio.conf for encryption magic" echo "~> Patching mkinitcpio.conf for encryption magic"
@ -38,8 +28,3 @@ echo "HOOKS=\"base udev autodetect modconf block keyboard keymap encrypt filesys
echo "~> ... and recompile the kernel" echo "~> ... and recompile the kernel"
arch-chroot /mnt mkinitcpio -p linux arch-chroot /mnt mkinitcpio -p linux
echo "~> Patching pacman.conf for some pacman magic."
arch-chroot /mnt sed -i "s/\[options\]/\[options\]\nILoveCandy/g" /etc/pacman.conf
amf_return=0

14
steps/60-user.step Executable file

@ -0,0 +1,14 @@
#!/bin/sh
echo -n "~> Do you want to create an user account? (Y/n) "
read answer
if [ "$answer" == "n" ]; then
exit 0
else
echo -n " Name of your new user? "
read name
arch-chroot /mnt useradd -m $name
arch-chroot /mnt passwd $name
exit 0
fi