feat: new install script with dwm

This commit is contained in:
AngeD 2023-03-14 17:33:29 +01:00
parent e998c9869a
commit 2724a43e07
14 changed files with 376 additions and 0 deletions

View File

@ -1,2 +1,32 @@
# archinstall
My personal Arch install script. It automates from step 2 of ArchWiki's
[Installation guide](https://wiki.archlinux.org/title/Installation_guide)
and more!
## How to
Follow the [Pre-installation](https://wiki.archlinux.org/title/Installation_guide#Pre-installation).
Once you chrooted in the system, clone this script
```bash
git clone https://git.maby.dev/ange/archinstall.git /tmp/ai
cd /tmp/ai/
```
**Review and edit the `config` file before running any script!**
To install the base system, run:
```bash
./base_install.sh
```
If you want a post install script, login as a normal user and run (replace
*desktopEnvironment* with your choice):
```bash
./desktopEnvironment/install.sh
```
For the dotfiles, run the script as the new user:
```bash
su $user -c ./dotfiles.sh
```

55
base_install.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash -e
cd "$(dirname "$0")"
. ./config
NORMAL='\e[0m'
BOLD='\e[1m'
GREEN='\e[32m'
PACMAN='pacman --needed -Syu'
# System config
ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime
hwclock --systohc
timedatectl set-ntp true
for l in "${locales[@]}"; do
sed -i "/#\s*$l/s/^#\s*//" /etc/locale.gen # todo test
done
locale-gen
echo "LANG=$lang" > /etc/locale.conf
echo "$hostname" > /etc/hostname
# Packages
cp -rf rootfs/ /
$PACMAN "${pkg[@]}"
systemctl enable NetworkManager
systemctl enable reflector.timer
if [ -d /sys/module/battery/ ]; then
$PACMAN "${laptop_pkg[@]}"
systemctl enable tlp
fi
# Users
echo "root:$root_passwd" | chpasswd
useradd -mG wheel "$username"
echo "$username:$user_passwd" | chpasswd
sed -i '/%wheel\s\+ALL=(ALL)\s\+ALL/s/^#\s*//' /etc/sudoers
# Bootloader
case "$(lscpu | grep Vendor)" in
*AuthenticAMD*)
$PACMAN amd-ucode
;;
*GenuineIntel*)
$PACMAN intel-ucode
;;
esac
bootctl install
cp loader/ /boot/loader # TODO
mkinitcpio -P
echo -e "${BOLD}${GREEN}DONE. Ctrl+D, umount -R /mnt and reboot${NORMAL}"

40
config Normal file
View File

@ -0,0 +1,40 @@
# User Variables
# Comment to disable
username=ange
user_passwd=ange
root_passwd=root
hostname="$username-pc"
tz='Europe/Paris'
locales=(
'en_US.UTF-8'
)
lang="${locales[0]}"
esp="$(lsblk -f | grep vfat | grep -o '/boot.\+')"
pkg=(
base-devel
docker{,-compose}
efibootmgr
fuse
git
htop
man-{db,pages}
mpv
neofetch
neovim
networkmanager
ranger
reflector
terminus-font awesome-terminal-fonts
tree
udisks2
zsh
)
laptop_pkg=(
tlp
)

19
dotfiles.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash -e
config="git --git-dir $HOME/.dotfiles --work-tree $HOME"
repo='https://git.maby.dev/ange/.dotfiles.git'
if [ "$EUID" = 0 ]; then
echo 'You are currently logged in as root. Continue?'
read -r
fi
git clone --bare "$repo" "$HOME/.dotfiles"
while ! $config checkout; do
echo 'Please remove conflicted files and press enter:'
read -r
done
$config submodule update --init --recursive --remote
$config config status.showUntrackedFiles no

20
dwm/config Normal file
View File

@ -0,0 +1,20 @@
# User Variables
# Comment to disable
pkg=(
alacritty
dunst
feh
firefox
flameshot
i3lock xss-lock
materia-{gtk-theme,kde} papirus-icon-theme gtk-engine-murrine
noto-fonts{,-cjk,-emoji} ttf-{dejavu,liberation}
numlockx
pcmanfm
picom
pipewire{,-pulse} wireplumber pavucontrol playerctl
polkit-gnome
redshift
xorg-{server,xinit,xrandr,xsetroot} xclip
)

View File

@ -0,0 +1,6 @@
Section "InputClass"
Identifier "keyboard"
MatchIsKeyboard "true"
Option "XkbLayout" "us"
Option "XkbVariant" "altgr-intl"
EndSection

View File

@ -0,0 +1,8 @@
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "true"
Option "Tapping" "true"
Option "ClickMethod" "clickfinger"
Option "NaturalScrolling" "true"
EndSection

View File

@ -0,0 +1,6 @@
Section "InputClass"
Identifier "mouse"
Driver "libinput"
MatchIsPointer "true"
Option "AccelProfile" "flat"
EndSection

View File

@ -0,0 +1 @@
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w $sys$devpath/brightness"

34
dwm/install.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash -e
cd "$(dirname "$0")"
. ./config
NORMAL='\e[0m'
BOLD='\e[1m'
GREEN='\e[32m'
PACMAN='pacman --needed -Syu'
if [ "$EUID" = 0 ]; then
echo 'This script needs root privileges.'
exit 1
fi
# drivers
case "$(lspci -k | grep -A3 -E '(VGA|3D)')" in
*amdgpu*)
pkg=("${pkg[@]}" xf86-video-amdgpu)
;;
*i915*)
pkg=("${pkg[@]}" xf86-video-intel)
;;
*nouveau*)
pkg=("${pkg[@]}" xf86-video-nouveau)
;;
esac
$PACMAN "${pkg[@]}"
cp -rf etc /etc
echo -e "${BOLD}${GREEN}DONE. You can reboot.${NORMAL}"
# TODO install dwm

32
gpu.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash -e
cd "$(dirname "$0")"
NORMAL='\e[0m'
BOLD='\e[1m'
GREEN='\e[32m'
if [ "$EUID" = 0 ]; then
echo 'This script needs root privileges.'
exit 1
fi
case "$(lspci -k | grep -E '(VGA|3D)')" in
*NVIDIA*)
$PACMAN nvidia{,-utils,-settings}
mkdir -p /etc/pacman.d/hooks/
cp nvidia.hook /etc/pacman.d/hooks/
modules='nvidia nvidia_modeset nvidia_uvm nvidia_drm'
;;
*AMD*)
$PACMAN mesa vulkan-radeon
modules=amdgpu
;;
*Intel*)
$PACMAN mesa vulkan-intel
modules=i915
;;
esac
sed -i "s/^MODULES=(/MODULES=($modules/" /etc/mkinitcpio.conf
echo -e "${BOLD}${GREEN}DONE. You can reboot.${NORMAL}"

15
nvidia.hook Normal file
View File

@ -0,0 +1,15 @@
[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia
Target=linux
# Change the linux part above and in the Exec line if a different kernel is used
[Action]
Description=Update NVIDIA module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P'

101
rootfs/etc/pacman.conf Normal file
View File

@ -0,0 +1,101 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
#NoProgressBar
CheckSpace
VerbosePkgLists
ParallelDownloads = 8
ILoveCandy
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
#[multilib]
#Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@ -0,0 +1,9 @@
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd
[Action]
Description = Gracefully upgrading systemd-boot...
When = PostTransaction
Exec = /usr/bin/systemctl restart systemd-boot-update.service