This commit is contained in:
olari
2019-04-13 22:28:43 +03:00
commit cbf6cd3f07
19 changed files with 1066 additions and 0 deletions

142
bash/arch_install.sh Executable file
View File

@@ -0,0 +1,142 @@
#!/bin/bash
# Discard on use
rm $0
KEYMAP="dvorak-programmer"
DEVICE="/dev/sda"
HOSTNAME=""
USER="olari"
USER_PASS=""
ROOT_PASS=""
REGION="Europe/Tallinn"
MIRROR="http://mirrors.dotsrc.org/archlinux/\$repo/os/\$arch"
partition_disk() {
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${DEVICE}
g # Create gpt partition table.
## Create partitions
n # Create efi partition...
1 # ... at index 1...
# ... at default start pos...
+512M # ... with 512MB size.
n # Create swap partition...
2 # ... at index 2...
# ... at default start pos...
+4G # ... with 4G size.
n # Create root partition...
3 # ... at index 3...
# ... at default start pos...
# ... with max size.
## Set partition types
t # Change parition type...
1 # ... of the efi partition...
1 # ... to "1 EFI System".
t # Change partition type...
2 # ... of the swap partition...
19 # ... to "19 Linux swap".
t # Change partition type...
3 # ... of the root partition...
20 # ... to "20 Linux filesystem"
w # Write changes
q # Quit
EOF
}
format_partitions() {
mkfs.fat -F32 ${DEVICE}1
mkswap ${DEVICE}2
swapon ${DEVICE}2
mkfs.ext4 ${DEVICE}3
}
mount_partitions() {
mount ${DEVICE}3 /mnt
mkdir /mnt/boot
mount ${DEVICE}1 /mnt/boot
}
set_pacman_mirror() {
sed -i "1iServer = $MIRROR" /etc/pacman.d/mirrorlist
}
create_fstab() {
cat <<EOT > /mnt/etc/fstab
/dev/sda1 /boot vfat defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext4 noatime,discard 0 1
EOT
}
create_chroot_script() {
cat <<EOT > /mnt/chroot_script.sh
#!/bin/sh
# Discard on use
rm $0
# Sync clock
ln -sf /usr/share/zoneinfo/${REGION} /etc/localtime
hwclock --systohc
# Generate locale
sed -i '1ien_US.UTF-8 UTF-8' /etc/locale.gen
locale-gen
# Set locale options
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "KEYMAP=${KEYMAP}" > /etc/vconsole.conf
# Set hostname
echo "${HOSTNAME}" > /etc/hostname
# Set up hosts file
echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}" > /etc/hosts
# Install Gnome
pacman -S --noconfirm gnome
systemctl enable gdm
systemctl enable NetworkManager
# Set up bootloader
pacman -S --noconfirm efibootmgr intel-ucode grub
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg
# Set root password
echo "root:${ROOT_PASS}" | chpasswd
# Create user and set password
useradd -m -G wheel -s /bin/bash ${USER}
echo "${USER}:${USER_PASS}" | chpasswd
# Enable sudo for wheel group
sed -i '1i%wheel ALL=(ALL) NOPASSWD: ALL' /etc/sudoers
exit
EOT
chmod +x /mnt/chroot_script.sh
}
timedatectl set-ntp true
partition_disk
format_partitions
mount_partitions
set_pacman_mirror
pacstrap /mnt base base-devel
create_fstab
create_chroot_script
arch-chroot /mnt /bin/sh chroot_script.sh
reboot

66
bash/arch_setup.sh Executable file
View File

@@ -0,0 +1,66 @@
#!/bin/bash
# Discard on use
rm $0
DRIVER_PACKAGES=(
xf86-video-
xf86-input-
)
install_packages() {
PACKAGES=(
ttf-dejavu
ttf-liberation
noto-fonts-cjk
noto-fonts-emoji
p7zip
unrar
unzip
mpv
feh
zathura
zathura-djvu
zathura-pdf-mupdf
zathura-cb
audacious
termite
ranger
neofetch
htop
tmux
ntfs-3g
vim
firefox
youtube-dl
openssh
wget
curl
transmission
gcc
gdb
cmake
code
)
PACKAGES += DRIVER_PACKAGES
yay -S --noconfirm ${PACKAGES[*]}
}
install_yay() {
sudo pacman -Syyu --noconfirm git
git clone https://aur.archlinux.org/yay.git ~/temp_yay
cd ~/temp_yay
makepkg -si
cd
rm -rf ~/temp_yay
}
install_yay
install_packages

25
bash/disable_audio_delay.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Discard on use
rm $0
# Increase nice and rtprio limits.
local user=$(cut -d' ' -f1 <<< $(who))
echo "$user - nice -20
$user - rtprio 99" | sudo tee --append /etc/security/limits.conf
# Create pulseaudio config.
sudo mkdir -p /etc/pulse/daemon.conf.d/
echo "high-priority = yes
nice-level = -15
realtime-scheduling = yes
realtime-priority = 50
resample-method = speex-float-0
default-fragments = 5
default-fragment-size-msec = 2" | sudo tee --append /etc/pulse/daemon.conf.d/10-lower-latency.conf
# Disable timer-based scheduling.
sudo sed -i 's/load-module module-udev-det*/load-module module-udev-detect tsched=0/g' /etc/pulse/default.pa

12
bash/disable_mouse_accel.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Discard on use
rm $0
sudo mkdir -p /etc/X11/xorg.conf.d/
echo 'Section "InputClass"
Identifier "My Mouse"
Driver "libinput"
MatchIsPointer "yes"
Option "AccelProfile" "flat"
EndSection' | sudo tee --append /etc/X11/xorg.conf.d/50-mouse-acceleration.conf

43
bash/install_osu.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
# Discard on use
rm $0
# https://blog.thepoon.fr/osuLinuxAudioLatency/
sudo pacman-key --keyserver hkps://hkps.pool.sks-keyservers.net -r C0E7D0CDB72FBE95
sudo pacman-key --keyserver hkps://hkps.pool.sks-keyservers.net --lsign-key C0E7D0CDB72FBE95
echo "[thepoon]
Server = https://archrepo.thepoon.fr
Server = https://mirrors.celianvdb.fr/archlinux/thepoon
" | sudo tee --append /etc/pacman.conf
sudo pacman -S wine-osu winetricks
mkdir ~/osu!
cd ~/osu!
wget https://m1.ppy.sh/r/osu\!install.exe
export WINEPREFIX="$HOME/.wine_osu"
export WINEARCH=win32
winetricks dotnet40 &
cat <<EOF > ~/osu!/start.sh
#!/bin/sh
export WINEPREFIX="$HOME/.wine_osu"
export STAGING_AUDIO_DURATION=8000
export PATH=/opt/wine-osu/bin:$PATH
cd ~/osu!
wine osu!.exe "$@"
EOF
cat <<EOF > ~/osu!/kill.sh
#!/bin/sh
export WINEPREFIX="$HOME/.wine_osu"
wineserver -k
EOF

10
bash/install_steam.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
# Discard on use
rm $0
echo "[multilib]
Include = /etc/pacman.d/mirrorlist
" | sudo tee --append /etc/pacman.conf
sudo pacman -S steam steam-native-runtime