Skip to content

Instantly share code, notes, and snippets.

@unipi-user
Created August 21, 2016 22:40
Show Gist options
  • Save unipi-user/a20819510c502f7b615dcbfaffd3604e to your computer and use it in GitHub Desktop.
Save unipi-user/a20819510c502f7b615dcbfaffd3604e to your computer and use it in GitHub Desktop.
Archi
#!/bin/bash
#Pre-Installation
# Connect to the Internet
# wifi-menu
# Update the system clock
timedatectl set-ntp true
# Partition the disks
echo "mklabel gpt
mkpart ESP fat32 1MiB 200MiB
set 1 boot on
mkpart primary ext4 200MiB 100%
quit
" | parted /dev/sda
# Format the partitions
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
# Mount the partitions
mount /dev/sda2 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
# Select the mirrors
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
grep -E -A 1 ".*Germany.*$" /etc/pacman.d/mirrorlist.bak | sed '/--/d' > /etc/pacman.d/mirrorlist
# Install the base packages
pacstrap -i /mnt base base-devel
# Configure the system
genfstab -U /mnt > /mnt/etc/fstab
# Copy the scripts to the new system
cp -r ~/Installation/ /mnt/
# Change root into the new system and start second Script
echo "Execute Arch-Installation.sh"
arch-chroot /mnt /bin/bash
#!/bin/bash
#Installation
# Set the hostname
read -p "Set hostname: " hostName
echo $hostName > /etc/hostname
# Set the root password
echo "Set root password:"
passwd
# Set timezone (or use tzselect)
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# Set locales and generate them
echo LANG=de_DE.UTF-8 > /etc/locale.conf
echo LANGUAGE=de_DE >> /etc/locale.conf
echo KEYMAP=de-latin1 > /etc/vconsole.conf
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
echo "en_US ISO-8859-1" >> /etc/locale.gen
echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen
echo "de_DE ISO-8859-1" >> /etc/locale.gen
locale-gen
# Fix pacman: Signature is unknown trust
rm -Rf /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate archlinux
# Create a new initial RAM disk
mkinitcpio -p linux
# Install and configure the Bootloader
bootctl install
echo "title Arch Linux" > /boot/loader/entries/arch.conf
echo "linux /vmlinuz-linux" >> /boot/loader/entries/arch.conf
echo "initrd /initramfs-linux.img" >> /boot/loader/entries/arch.conf
echo "options root=/dev/sda2 rw" >> /boot/loader/entries/arch.conf
echo "default arch" > /boot/loader/loader.conf
# Exit the chroot environment and reboot (optionaly add: umount -R /mnt)
echo "1. exit | 2. umount -R /mnt | 3. reboot | 4. Execute Arch-Post-Installation.sh"
#!/bin/bash
#Post-Installation
# Create user and set password
read -p "Set user name:" userName
useradd -m -g users -G wheel,storage,power,audio,video -s /bin/bash $userName
echo "Set user password:"
passwd $userName
# Header files and scripts for building modules for Linux kernel
pacman -Syy
pacman -S linux-headers
# Install important services
pacman -S --noconfirm acpid ntp dbus avahi cups cronie ufw
# Enable important services
systemctl enable acpid
systemctl enable ntpd
systemctl enable cronie
systemctl enable ufw
# Configure the network
pacman -S wpa_supplicant dialog
cp /etc/netctl/examples/wireless-wpa /etc/netctl/
ip addr
read -p "Press any key to continue... " -n1 -s
nano /etc/netctl/wireless-wpa
netctl enable wireless-wpa
# Install command line and ncurses programs
pacman -S --noconfirm sudo
pacman -S --noconfirm bash-completion
# pacman -S --noconfirm alsa-utils
pacman -S --noconfirm pulseaudio
pacman -S --noconfirm htop
pacman -S --noconfirm screen
pacman -S --noconfirm wget
pacman -S --noconfirm scrot
pacman -S --noconfirm xdotool
pacman -S --noconfirm xclip
pacman -S --noconfirm rfkill
# Install xorg and graphics
pacman -S --noconfirm xorg xorg-xinit mesa
# Install desktop & window manager
pacman -S --noconfirm i3-wm i3status
pacman -S --noconfirm dmenu
# Install graphical programs
pacman -S --noconfirm rxvt-unicode
pacman -S --noconfirm firefox flashplugin # + Adblocker
pacman -S --noconfirm gnome-calculator
pacman -S --noconfirm skype
# pacman -S --noconfirm libreoffice
pacman -S --noconfirm evince
# pacman -S --noconfirm vlc qt4
pacman -S --noconfirm geany
# pacman -S --noconfirm gimp
pacman -S --noconfirm pcmanfm gvfs udisks ntfs-3g file-roller zip unzip unrar p7zip
pacman -S --noconfirm gutenprint ghostscript gsfonts simple-scan
pacman -S --noconfirm gpicview
pacman -S --noconfirm ffmpeg
pacman -S --noconfirm zenity
pacman -S --noconfirm git
pacman -S --noconfirm feh
# pacman -S --noconfirm transmission-gtk
# pacman -S --noconfirm virtualbox virtualbox-host-modules-arch virtualbox-guest-iso
# pacman -S --noconfirm openvpn
# pacman -S --noconfirm gnome-system-monitor
# Install from AUR
# cower
# teamviewer
# Configure sudo
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
# Add User-martin to VirtualBox-Group
# gpasswd -a martin vboxusers
# Mount device without root
mkdir -p /media/$userName/
echo "# /dev/sdb2" >> /etc/fstab
echo "/dev/sdb2 /media/$userName vfat noauto,user,rw 1 0" >> /etc/fstab
# Allow to execute Wifi-menu without password
echo "martin ALL = NOPASSWD: /usr/bin/wifi-menu" >> /etc/sudoers
# Allow to execute shutdown without password
echo "martin ALL = NOPASSWD: /usr/bin/shutdown" >> /etc/sudoers
# Configure Keyboardlayout
localectl set-x11-keymap de pc105 nodeadkeys
echo "#! /bin/bash" > /home/$userName/.xinitrc
echo "setxkbmap -model pc105 -layout de -variant nodeadkeys" >> /home/$userName/.xinitrc
# Configure synaptics touchpad
cat << "TAGTEXTFILE" > /etc/X11/xorg.conf.d/50-synaptics.conf
# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# DO NOT EDIT THIS FILE, your distribution will likely overwrite
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
# Option "OptionName" "value"
#
# Identifier "touchpad catchall"
Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertEdgeScroll" "on"
Option "VertTwoFingerScroll" "on"
Option "HorizEdgeScroll" "on"
Option "HorizTwoFingerScroll" "on"
Option "CircularScrolling" "on"
Option "CircScrollTrigger" "2"
Option "EmulateTwoFingerMinZ" "40"
Option "EmulateTwoFingerMinW" "8"
Option "CoastingSpeed" "0"
Option "FingerLow" "30"
Option "FingerHigh" "50"
Option "MaxTapTime" "125"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
MatchDevicePath "/dev/input/event*"
EndSection
Section "InputClass"
Identifier "touchpad ignore duplicates"
MatchIsTouchpad "on"
MatchOS "Linux"
MatchDevicePath "/dev/input/mouse*"
Option "Ignore" "on"
EndSection
# This option enables the bottom right corner to be a right button on clickpads
# and the right and middle top areas to be right / middle buttons on clickpads
# with a top button area.
# This option is only interpreted by clickpads.
Section "InputClass"
Identifier "Default clickpad buttons"
MatchDriver "synaptics"
Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%"
EndSection
# This option disables software buttons on Apple touchpads.
# This option is only interpreted by clickpads.
Section "InputClass"
Identifier "Disable clickpad buttons on Apple touchpads"
MatchProduct "Apple|bcm5974"
MatchDriver "synaptics"
Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
EndSection
TAGTEXTFILE
# Configure urxvt terminal
cat << "TAGTEXTFILE" >> /home/$userName/.Xdefaults
! urxvt
URxvt*font: xft:Inconsolata:pixelsize=17:antialias=true:hinting=true
URxvt*boldFont: xft:Inconsolata:bold:pixelsize=17:antialias=false:hinting=true
URxvt*depth: 24
URxvt*borderless: 1
URxvt*scrollBar: false
URxvt*saveLines: 2000
URxvt.transparent: false
URxvt*.shading: 10
! disable the ctrl+shift feature
URxvt.iso14755: false
URxvt.iso14755_52: false
!urxvt color scheme:
URxvt*background: #2B2B2B
URxvt*foreground: #DEDEDE
TAGTEXTFILE
: '
# Configure alsamixer
cat << "TAGTEXTFILE" >> /etc/asound.conf
# Configure alsamixer
defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1
# Increase Speaker Volume
pcm.!default {
type asym
playback.pcm "plug:softvol"
capture.pcm "plug:dsnoop"
}
pcm.softvol {
type softvol
slave.pcm "dmix"
control { name "PCM"; card 0; }
max_dB 32.0
}
TAGTEXTFILE
'
# Configure i3status
cat << "TAGTEXTFILE" >> /home/$userName/.i3status.conf
general {
colors = true
interval = 5
}
order += "wireless _first_"
order += "battery 0"
order += "tztime local"
wireless _first_ {
format_up = "☻"
format_down = "☻"
}
battery 0 {
format = "%status %percentage"
}
tztime local {
format = "%d-%m-%Y %H:%M"
}
TAGTEXTFILE
# Feh set background
echo "sh /home/$userName/.fehbg &" >> ~/.xinitrc
# Configure xinit
echo "exec i3" >> /home/$userName/.xinitrc
# Configure auto startX
cp /etc/skel/.bash_profile /home/$userName/
echo "startx" >> /home/$userName/.bash_profile
# Finish
echo "Installation finished!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment