Skip to content

Instantly share code, notes, and snippets.

@themaxhero
Last active May 30, 2020 00:30
Show Gist options
  • Save themaxhero/fa9ea883c3c1a9f3668a3ba6be72990a to your computer and use it in GitHub Desktop.
Save themaxhero/fa9ea883c3c1a9f3668a3ba6be72990a to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
set -o errexit
VOLUMES=($(lsblk -npo KNAME | grep -v 'loop\|sr'))
SIZES=($(lsblk -npo KNAME,SIZE | grep -v 'loop\|sr' | awk 'BEGIN {FS=" "}; {print $2}'))
COUNT=$(lsblk -n | grep -v 'loop\|sr' | wc -l)
RADIOLIST=()
for i in $(seq 0 $(expr $COUNT - 1));
do
RADIOLIST+=(${VOLUMES[i]} ${SIZES[i]} "OFF")
done
boot_disk=$(whiptail --title "Select boot disk"\
--radiolist "Select boot disk" 22 88 ${#VOLUMES[@]} \
${RADIOLIST[@]}\
3>&1 1>&2 2>&3)
clear
root_disk=$(whiptail --title "Select root disk"\
--radiolist "Select root disk" 22 88 ${#VOLUMES[@]} \
${RADIOLIST[@]}\
3>&1 1>&2 2>&3)
clear
hostname=$(whiptail --title "Settings hostname"\
--inputbox "Please, set a hostname: " 22 88\
3>&1 1>&2 2>&3)
clear
root_password=$(whiptail --title "Setting root password"\
--passwordbox "Please, set a root password: " 22 88\
3>&1 1>&2 2>&3)
clear
username=$(whiptail --title "Settings username"\
--inputbox "Please, set a username: " 22 88\
3>&1 1>&2 2>&3)
clear
password=$(whiptail --title "Setting ${username}'s password"\
--passwordbox "Please, set ${username}'s password: " 22 88\
3>&1 1>&2 2>&3)
clear
swap_part=`[ $boot_disk = $root_disk ] && echo -e 2 || echo -e 1`
root_part=`[ $boot_disk = $root_disk ] && echo -e 3 || echo -e 2`
tgt_boot_partition="${boot_disk}1"
tgt_root_partition="${root_disk}${root_part}"
swap_partition="${root_disk}${swap_part}"
allright=$(whiptail --title "Confirm Setup"\
--yesno \
"Boot will be on ${tgt_boot_partition}\nRoot will be on ${tgt_root_partition}\nSwap will be on ${swap_partition}\n\nIs that Right?" 22 88\
3>&1 1>&2 2>&3)
format_efi_broot(){
parted --script "${root_disk}" -- mklabel gpt \
mkpart ESP fat32 1Mib 513MiB \
set 1 boot on
}
format_efi_boot(){
parted --script "${boot_disk}" -- mklabel gpt \
mkpart ESP fat32 1Mib 513MiB \
set 1 boot on
}
format_efi(){
if test $boot_disk = $root_disk; then
format_efi_broot
else
format_efi_boot
fi
}
format_root(){
if [ $root_disk = $boot_disk ]; then
parted --script "${root_disk}" -- \
mkpart primary linux-swap 513MiB 8GiB \
mkpart primary ext4 8GiB 100%
else
parted --script "${root_disk}" -- mklabel gpt \
mkpart primary linux-swap 1Mib 8GiB \
mkpart primary ext4 8GiB 100%
fi
}
format_efi
format_root
# Create boot
mkfs.vfat -F32 ${tgt_boot_partition}
# Create linux Partition and Swap
mkswap -f ${swap_partition}
mkfs.ext4 ${tgt_root_partition}
e2label ${tgt_root_partition} Archlinux
# Mount
mount ${tgt_root_partition} /mnt
mkdir -p /mnt/boot
mount ${tgt_boot_partition} /mnt/boot
swapon ${swap_partition}
rootmnt=/mnt
bootmnt=$rootmnt/boot
# System Bootstrap
pacstrap -GM ${rootmnt} base base-devel
genfstab -U ${rootmnt} | tee -a $rootmnt/etc/fstab > /dev/null
pushd ${rootmnt}
# Set Locale
pushd ./etc
rm ./localtime || echo 'There was no localtime'
ln -s ../usr/share/zoneinfo/America/Sao_Paulo ./localtime
popd
echo -e 'en_US.UTF-8 UTF-8' | tee -a ./etc/locale.gen > /dev/null
echo -e 'ja_JP.UTF-8 UTF-8' | tee -a ./etc/locale.gen > /dev/null
echo -e 'pt_BR.UTF-8 UTF-8' | tee -a ./etc/locale.gen > /dev/null
echo -e 'LANG=en_US.UTF-8' | cp /dev/stdin ./etc/locale.conf
echo -e 'KEYMAP=br-abnt2' | cp /dev/stdin ./etc/vconsole.conf
chmod 644 ./etc/locale.conf
cat <<EOF | tee -a ./etc/xdg/plasmarc > /dev/null
[Theme]
name=breeze-dark
EOF
chmod 644 ./etc/xdg/plasmarc
# Set hostname and hosts
echo -e $hostname | cp /dev/stdin ./etc/hostname > /dev/null
cat <<EOF | tee -a ./etc/hosts > /dev/null
127.0.0.1 localhost
::1 localhost
127.0.1.1 $hostname.localdomain $hostname
EOF
# Adding Packman Brazilian mirrors
cat <<EOF | tee ./etc/pacman.d/mirrorlist > /dev/null
Server = http://mirror.ufscar.br/archlinux/\$repo/os/\$arch
Server = http://archlinux.c3sl.ufpr.br/\$repo/os/\$arch
Server = http://www.caco.ic.unicamp.br/archlinux/\$repo/os/\$arch
Server = https://www.caco.ic.unicamp.br/archlinux/\$repo/os/\$arch
Server = http://linorg.usp.br/archlinux/\$repo/os/\$arch
Server = http://pet.inf.ufsc.br/mirrors/archlinux/\$repo/os/\$arch
Server = http://archlinux.pop-es.rnp.br/\$repo/os/\$arch
Server = http://mirror.ufam.edu.br/archlinux/\$repo/os/\$arch
Server = http://br.mirror.archlinux-br.org/\$repo/os/\$arch
EOF
# Adding Chaotic AUR
cat <<EOF | tee -a ./etc/pacman.conf > /dev/null
[multilib]
Include = /etc/pacman.d/mirrorlist
[chaotic-aur]
Server = https://lonewolf.pedrohlc.com/\$repo/\$arch
Server = http://chaotic.bangl.de/\$repo/\$arch
EOF
arch-chroot . /usr/bin/bash <<EOF
#!/usr/bin/env sh
locale-gen
hwclock --systohc
timedatectl set-ntp true
pacman-key --init
pacman-key --populate archlinux
# Chaotic-AUR
pacman-key --keyserver keys.mozilla.org -r 3056513887B78AEB
pacman-key --lsign-key 3056513887B78AEB
pacman -Syu --noconfirm
groupmod -g 10 wheel
groupmod -g 100 users
useradd -Uu 1000 -m -g users -G wheel $username
# Install
pacman -S --noconfirm --needed --overwrite /boot/\\* \
base-devel linux-firmware linux-tkg-pds-skylake{,-headers} systemd-boot-pacman-hook \
multilib-devel arch-install-scripts git man{,-pages} \
sudo yay networkmanager pulseaudio-{alsa,bluetooth,jack} ibus-mozc \
\
efibootmgr os-prober \
ntfs-3g dosfstools mtools exfat-utils un{rar,zip} p7zip \
gvfs-mtp android-udev-git sshfs usbutils wget aria2 \
\
dash fish libpam-google-authenticator mosh powerpill rsync aria2 tmux \
neovim-{drop-in,plug} discord openssh htop bridge-utils alsa-utils traceroute nmap \
android-sdk-platform-tools ddclient dnsmasq hostapd tor inetutils \
networkmanager-openvpn ca-certificates-icp_br \
\
{,lib32-}mesa {,lib32-}libva intel-media-driver {,lib32-}vulkan-icd-loader \
{,lib32-}vulkan-radeon intel-ucode \
\
bluez{,-plugins,-utils} cups sane \
cadence jack2 jack_capture \
\
i3 i3lock i3status grim waybar wofi-hg breeze{,-gtk,-icons} \
menu-calc mako wdisplays-git lxappearance \
wl-clipboard-x11 qt5-wayland xdg-desktop-portal{,-wlr-git} \
\
alacritty nomacs pcmanfm-qt qbittorrent telegram-desktop xarchiver \
firefox-wayland-hg firefox-ublock-origin \
wps-office{,-mui-pt-br} ttf-wps-fonts \
wps-office-extension-portuguese-brazilian-dictionary \
mpv audacious{,-plugins} gst-libav kodi-wayland spotify youtube-dl \
gomics-git paprefs pavucontrol print-manager system-config-printer \
\
dxvk-mingw-git {,lib32-}faudio steam steam-native-runtime \
wine{_gecko,-mono,-tkg-staging-fsync-git} \
xf86-input-libinput proton-tkg-git \
\
keybase kbfs qemu vinagre yeecli easy-rsa scrcpy-git \
gdb dbeaver editorconfig-core-c python-{pip,pynvim} hunspell-{en_US,pt-br} \
\
gnu-free-fonts otf{-font-awesome,-ipafont} gnome-icon-theme \
ttf-{dejavu,droid,fira-{code,mono,sans}} \
ttf-{liberation,ms-fonts,ubuntu-font-family,wps-fonts,hanazono,sazanami,baekmuk} \
adobe-source-han-sans-jp-fonts adobe-source-han-sans-kr-fonts unityhub
yay -S aic94xx-firmware wd719x-firmware
groupmod -g 10 wheel
groupmod -g 100 users
useradd -u 1000 -m -G wheel -g users -s /bin/bash $username
chsh root -s /bin/bash
chsh $username -s /bin/bash
usermod \
-aG audio -aG video -aG input -aG kvm \
$username
echo -e '%wheel ALL=(ALL) NOPASSWD: ALL' | tee -a ./etc/sudoers
echo -e 'Defaults env_reset,pwfeedback' | tee -a ./etc/sudoers
systemctl enable NetworkManager
systemctl enable sshd
mkinitcpio -Pv
bootctl install --path=/boot
EOF
arch-chroot . /usr/bin/sudo -u $username bash <<EOF
git clone https://github.com/asdf-vm/asdf.git \$HOME/.asdf --branch v0.7.8
echo -e '\n. \$HOME/.asdf/asdf.sh' >> \$HOME/.bashrc
echo -e '\n. \$HOME/.asdf/completions/asdf.bash' >> \$HOME/.bashrc
echo 'source \$HOME/.asdf/asdf.fish' >> \$HOME/.config/fish/config.fish
mkdir -p \$HOME/.config/fish/completions && cp \$HOME/.asdf/completions/asdf.fish \$HOME/.config/fish/completions
asdf plugin-add clojure
asdf plugin-add crystal
asdf plugin-add dotnet-core
asdf plugin-add elixir
asdf plugin-add elm
asdf plugin-add erlang
asdf plugin-add haskell
asdf plugin-add lua
asdf plugin-add luaJIT
asdf plugin-add nodejs
asdf plugin-add ruby
asdf plugin-add rust
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf install clojure latest
asdf install crystal latest
asdf install dotnet-core latest
asdf install elixir latest
asdf install elm latest
asdf install erlang latest
asdf install haskell latest
asdf install lua latest
asdf install luaJIT latest
asdf install nodejs latest
asdf install ruby latest
asdf install rust latest
asdf global clojure $(asdf list clojure | tail -n 1)
asdf global crystal $(asdf list crystal | tail -n 1)
asdf global dotnet-core $(asdf list dotnet-core | tail -n 1)
asdf global elixir $(asdf list elixir | tail -n 1)
asdf global elm $(asdf list elm | tail -n 1)
asdf global erlang $(asdf list erlang | tail -n 1)
asdf global haskell $(asdf list haskell | tail -n 1)
asdf global lua $(asdf list lua | tail -n 1)
asdf global luaJIT $(asdf list luaJIT | tail -n 1)
asdf global nodejs $(asdf list nodejs | tail -n 1)
asdf global ruby $(asdf list ruby | tail -n 1)
asdf global rust $(asdf list rust | tail -n 1)
EOF
mkdir -p ./etc/systemd/system/[email protected]
cat <<EOF | tee -a ./etc/systemd/system/[email protected]/override.conf > /dev/null
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin maxhero --noclear %I \$TERM
Type=simple
EOF
mkdir -p ./home/$username/.config/sway
cat <<EOF | tee ./home/$username/.config/sway/config > /dev/null
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set \$mod Mod4
# Home row direction keys, like vim
set \$left h
set \$down j
set \$up k
set \$right l
# Your preferred terminal emulator
set \$term alacritty
set \$editor vim
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
# Exec mako
exec mako
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
#
# Example configuration:
#
# output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs
### Idle configuration
#
# Example configuration:
#
# exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \
# timeout 600 'swaymsg "output * dpms off"' \
# resume 'swaymsg "output * dpms on"' \
# before-sleep 'swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
default_border pixel 1
hide_edge_borders both
for_window [app_id="firefox" title="moz-extension:.*"] floating enable
for_window [app_id="firefox" title="Password Required"] floating enable
for_window [app_id="firefox" title="Picture-in-Picture"] floating enable; sticky enable
for_window [app_id="firefox" title="Firefox - Sharing Indicator"] floating enable; sticky enable
# bindsym $mod+shift+i Swap Input mode
exec ibus-daemon -drx --panel /usr/lib/ibus/ibus-ui-gtk3
bindsym XF86AudioLowerVolume exec /usr/bin/pactl set-sink-volume 0 -5%
bindsym XF86AudioRaiseVolume exec /usr/bin/pactl set-sink-volume 0 +5%
bindsym XF86AudioMute exec /usr/bin/pactl set-sink-mute 0 toggle
bindsym XF86WLAN exec $TERMINAL nmtui; mode "default"
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym \$mod+Return exec $term
bindsym Print exec grim -g "${slurp}" - | wl-copy
# Kill focused window
bindsym \$mod+Shift+q kill
# Start your launcher
bindsym \$mod+d exec wofi --gtk-dark --show run
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier \$mod normal
# Reload the configuration file
bindsym \$mod+Shift+c reload
# Exit sway (logs you out of your Wayland session)
bindsym \$mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
#
# Moving around:
#
# Move your focus around
bindsym \$mod+$left focus left
bindsym \$mod+$down focus down
bindsym \$mod+$up focus up
bindsym \$mod+$right focus right
# Or use \$mod+[up|down|left|right]
bindsym \$mod+Left focus left
bindsym \$mod+Down focus down
bindsym \$mod+Up focus up
bindsym \$mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym \$mod+Shift+$left move left
bindsym \$mod+Shift+$down move down
bindsym \$mod+Shift+$up move up
bindsym \$mod+Shift+$right move right
# Ditto, with arrow keys
bindsym \$mod+Shift+Left move left
bindsym \$mod+Shift+Down move down
bindsym \$mod+Shift+Up move up
bindsym \$mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym \$mod+1 workspace 1
bindsym \$mod+2 workspace 2
bindsym \$mod+3 workspace 3
bindsym \$mod+4 workspace 4
bindsym \$mod+5 workspace 5
bindsym \$mod+6 workspace 6
bindsym \$mod+7 workspace 7
bindsym \$mod+8 workspace 8
bindsym \$mod+9 workspace 9
bindsym \$mod+0 workspace 10
# Move focused container to workspace
bindsym \$mod+Shift+1 move container to workspace 1
bindsym \$mod+Shift+2 move container to workspace 2
bindsym \$mod+Shift+3 move container to workspace 3
bindsym \$mod+Shift+4 move container to workspace 4
bindsym \$mod+Shift+5 move container to workspace 5
bindsym \$mod+Shift+6 move container to workspace 6
bindsym \$mod+Shift+7 move container to workspace 7
bindsym \$mod+Shift+8 move container to workspace 8
bindsym \$mod+Shift+9 move container to workspace 9
bindsym \$mod+Shift+0 move container to workspace 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym \$mod+b splith
bindsym \$mod+v splitv
# Switch the current container between different layout styles
bindsym \$mod+s layout stacking
bindsym \$mod+w layout tabbed
bindsym \$mod+e layout toggle split
# Make the current focus fullscreen
bindsym \$mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym \$mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym \$mod+space focus mode_toggle
# Move focus to the parent container
bindsym \$mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym \$mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym \$mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym \$left resize shrink width 10px
bindsym \$down resize grow height 10px
bindsym \$up resize shrink height 10px
bindsym \$right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym \$mod+r mode "resize"
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
font pango:DejaVu Sans Mono, FontAwesome 9
swaybar_command waybar
colors {
separator #666666
background #222222
statusline #dddddd
focused_workspace #0088CC #0088CC #ffffff
active_workspace #333333 #333333 #ffffff
inactive_workspace #333333 #333333 #888888
urgent_workspace #2f343a #900000 #ffffff
}
}
#bar {
# position top
#
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
# status_command while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done
#
# colors {
# statusline #ffffff
# background #323232
# inactive_workspace #32323200 #32323200 #5c5c5c
# }
#}
include /etc/sway/config.d/*
EOF
mkdir -p ./home/$username/.config/nvim
cat <<EOF | tee ./home/$username/.config/nvim/init.vim > /dev/null
call plug#begin()
Plug 'kien/ctrlp.vim'
Plug 'kien/rainbow_parentheses.vim'
Plug 'rust-lang/rust.vim'
Plug 'lokikl/vim-ctrlp-ag'
Plug 'sillybun/vim-repl'
Plug 'linluk/vim-websearch'
Plug 'wakatime/wakatime'
Plug 'bling/vim-airline'
Plug 'reewr/vim-monokai-phoenix'
Plug 'vim-scripts/paredit.vim'
Plug 'mattn/gist-vim'
Plug 'juleswang/css.vim'
Plug 'avakhov/vim-yaml'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-lua-ftplugin'
Plug 'jcf/vim-latex'
Plug 'matt-deacalion/vim-systemd-syntax'
Plug 'vim-erlang/vim-erlang-compiler'
Plug 'itchyny/vim-haskell-indent'
Plug 'mechatroner/rainbow_csv'
Plug 'mboughaba/i3config.vim'
Plug 'tbastos/vim-lua'
Plug 'bfrg/vim-cpp-modern'
Plug 'othree/html5.vim'
Plug 'groenewege/vim-less'
Plug 'elzr/vim-json'
Plug 'tpope/vim-markdown'
Plug 'elixir-lang/vim-elixir'
Plug 'moll/vim-node'
Plug 'elmcast/elm-vim'
Plug 'vim-scripts/c.vim'
Plug 'terryma/vim-multiple-cursors'
call plug#end()
nnoremap <c-f> :CtrlPag<cr>
vnoremap <c-f> :CtrlPagVisual<cr>
nnoremap <leader>ca :CtrlPagLocate
nnoremap <leader>cp :CtrlPagPrevious<cr>
let g:ctrlp_ag_ignores = '--ignore .git
\ --ignore "deps/*"
\ --ignore "_build/*"
\ --ignore "node_modules/*"'
" :REPLToggle to Open the REPL https://vimawesome.com/plugin/vim-repl-with-ourselves
" :WebSearch hello world
let g:web_search_engine = "google"
let g:web_search_command = "firefox"
" Try vim-hooks later: https://vimawesome.com/plugin/vim-hooks
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#formatter = 'default'
" https://vimawesome.com/plugin/vim-lua-ftplugin
aug i3config_ft_detection
au!
au BufNewFile,BufRead ~/.config/i3/config set filetype=i3config
aug end
au! BufRead,BufNewFile *.json set filetype=json
augroup json_autocmd
autocmd!
autocmd FileType json set autoindent
autocmd FileType json set formatoptions=tcq2l
autocmd FileType json set textwidth=78 shiftwidth=2
autocmd FileType json set softtabstop=2 tabstop=8
autocmd FileType json set expandtab
autocmd FileType json set foldmethod=syntax
augroup END
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
let g:elm_jump_to_error = 1
let g:elm_make_show_warnings = 1
let g:elm_format_autosave = 1
let g:C_UseTool_cmake = 'yes'
let g:C_UseTool_doxygen = 'yes'
let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_start_word_key = '<C-d>'
let g:multi_cursor_select_all_word_key = '<A-d>'
let g:multi_cursor_start_key = 'g<C-d>'
let g:multi_cursor_select_all_key = 'g<A-d>'
let g:multi_cursor_next_key = '<C-d>'
let g:multi_cursor_prev_key = '<C-S-u>'
let g:multi_cursor_skip_key = '<C-S-d>'
let g:multi_cursor_quit_key = '<Esc>'
colorscheme monokai-phoenix
EOF
arch-chroot . <<EOF
chown $username:users /home/$username/.config/sway/config
chown $username:users /home/$username/.config/nvim/init.vim
EOF
# Bootloader
cat <<EOF | tee -a ./boot/loader/entries/arch-tkg.conf > /dev/null
title Arch Linux
linux /vmlinuz-linux-tkg-pds-skylake
initrd /intel-ucode.img
initrd /initramfs-linux-tkg-pds-skylake.img
options root=LABEL=Archlinux intel_iommu=on noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mitigations=off radeon.cik_support=0 radeon.si_support=0 amdgpu.si_support=1 amdgpu.cik_support=1 amdgpu.dpm=1 amdgpu.dc=1 modprobe.blacklist=radeon module_blacklist=radeon rw
EOF
cat <<EOF | tee ./boot/loader/loader.conf > /dev/null
timeout 4
default arch-tkg
EOF
# Clear
yes | arch-chroot . pacman -Scc
cat <<EOF | tee -a ./usr/local/bin/nowl
#!/usr/bin/env bash
unset CLUTTER_BACKEND
unset ECORE_EVAS_ENGINE
unset ELM_ENGINE
unset SDL_VIDEODRIVER
unset BEMENU_BACKEND
unset GTK_USE_PORTAL
export XKB_DEFAULT_LAYOUT='us'
export XKB_DEFAULT_VARIANT='intl'
export XKB_DEFAULT_OPTIONS='terminate:ctrl_alt_bksp'
export GDK_BACKEND='x11'
export XDG_SESSION_TYPE='x11'
export QT_QPA_PLATFORM='xcb'
export MOZ_ENABLE_WAYLAND=0
exec "\$@"
EOF
chmod +x ./usr/local/bin/nowl
cat <<EOF | tee -a ./usr/local/bin/startsway
#!/usr/bin/env sh
# Settings
export TERMINAL='alacritty'
export XDG_CONFIG_HOME="\$HOME/.config"
export XDG_DATA_HOME="\$HOME/.local/share"
export XDG_DATA_DIRS="\$HOME/.local/share/:/usr/local/share/:/usr/share/"
export RADV_PERFTEST=aco
export XKB_DEFAULT_LAYOUT='us'
export XKB_DEFAULT_VARIANT='intl'
export XKB_DEFAULT_OPTIONS='terminate:ctrl_alt_bksp'
# Native display
export BEMENU_BACKEND='wayland'
export MOZ_ENABLE_WAYLAND=1
export SAL_USE_VCLPLUGIN='gtk3'
export GDK_BACKEND='wayland'
export XDG_SESSION_TYPE='wayland'
export QT_QPA_PLATFORM='wayland'
export QT_WAYLAND_FORCE_DPI='physical'
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export CLUTTER_BACKEND='wayland'
export SDL_VIDEODRIVER='wayland'
export ECORE_EVAS_ENGINE='wayland_egl'
export ELM_ENGINE='wayland_egl'
#export GTK_USE_PORTAL=1
# Bug Fixing
export _JAVA_AWT_WM_NONREPARENTING=1
# Qt appearance
#requires plasma-integration (could be qt5ct instead)
export QT_QPA_PLATFORMTHEME='kde'
export QT_PLATFORMTHEME='kde'
export QT_PLATFORM_PLUGIN='kde'
export QT_IM_MODULE=ibus
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
# DE
export XDG_CURRENT_DESKTOP='sway'
exec sway
EOF
chmod +x ./usr/local/bin/startsway
arch-chroot . <<EOF
echo -e "$root_password\n$root_password" | passwd root
echo -e "$password\n$password" | passwd $username
EOF
popd
umount -R /mnt
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment