mirror of
https://github.com/rwinkhart/cachyos-postinstall-helper.git
synced 2026-08-27 20:36:32 -04:00
Install zsh and extensions; move custom .zshrc installation to applications
This commit is contained in:
+80
-15
@@ -7,7 +7,7 @@ import (
|
|||||||
func applications() {
|
func applications() {
|
||||||
for {
|
for {
|
||||||
var doAll bool
|
var doAll bool
|
||||||
choice := front.InputMenuGen("Application to install:", []string{"BACK", "ALL", "pamac-aur", "yay-bin", "htop", "neovim", "virt-manager (also installs qemu-desktop+libvirt)", "librewolf-bin", "zed", "steam"})
|
choice := front.InputMenuGen("Application to install:", []string{"BACK", "ALL", "pamac-aur", "yay-bin", "zsh", "htop", "neovim", "virt-manager (also installs qemu-desktop+libvirt)", "librewolf-bin", "zed", "steam"})
|
||||||
switch choice {
|
switch choice {
|
||||||
case 1:
|
case 1:
|
||||||
return
|
return
|
||||||
@@ -15,59 +15,124 @@ func applications() {
|
|||||||
doAll = true
|
doAll = true
|
||||||
fallthrough
|
fallthrough
|
||||||
case 3:
|
case 3:
|
||||||
managePackage("-S", "pamac-aur")
|
managePackages("-S", []string{"pamac-aur"})
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 4:
|
case 4:
|
||||||
managePackage("-S", "yay-bin")
|
managePackages("-S", []string{"yay-bin"})
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 5:
|
case 5:
|
||||||
managePackage("-S", "htop")
|
managePackages("-S", []string{"zsh", "zsh-autosuggestions", "zsh-syntax-highlighting"})
|
||||||
|
writeFile(mountPoint+"/home/"+getUsername()+"/.zshrc", zshrc, getUsername(), 0644)
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 6:
|
case 6:
|
||||||
managePackage("-S", "neovim")
|
managePackages("-S", []string{"htop"})
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 7:
|
case 7:
|
||||||
chrootCommandRun([]string{"pacman", "-S", "virt-manager", "qemu-desktop", "libvirt", "--noconfirm"})
|
managePackages("-S", []string{"neovim"})
|
||||||
|
|
||||||
|
if !doAll {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
case 8:
|
||||||
|
managePackages("-S", []string{"virt-manager", "qemu-desktop", "libvirt"})
|
||||||
manageService("enable", "libvirtd.service")
|
manageService("enable", "libvirtd.service")
|
||||||
manageService("start", "libvirtd.service")
|
manageService("start", "libvirtd.service")
|
||||||
// TODO manage user groups!
|
// TODO manage user groups!
|
||||||
|
|
||||||
if !doAll {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
fallthrough
|
|
||||||
case 8:
|
|
||||||
managePackage("-S", "librewolf-bin")
|
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 9:
|
case 9:
|
||||||
managePackage("-S", "zed")
|
managePackages("-S", []string{"librewolf-bin"})
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 10:
|
case 10:
|
||||||
managePackage("-S", "steam")
|
managePackages("-S", []string{"zed"})
|
||||||
|
|
||||||
|
if !doAll {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
case 11:
|
||||||
|
managePackages("-S", []string{"steam"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const zshrc = `# Shell settings
|
||||||
|
HISTFILE="$XDG_CACHE_HOME"/zsh-histfile
|
||||||
|
HISTSIZE=2500
|
||||||
|
SAVEHIST=2000
|
||||||
|
setopt INC_APPEND_HISTORY
|
||||||
|
setopt HIST_EXPIRE_DUPS_FIRST
|
||||||
|
setopt HIST_FIND_NO_DUPS
|
||||||
|
unsetopt beep
|
||||||
|
bindkey -e
|
||||||
|
zstyle :compinstall filename "/home/$USER/.zshrc"
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit -d "$XDG_CACHE_HOME"/zcompdump
|
||||||
|
PS1='%F{yellow}%?%F{cyan}|%n%f@%F{cyan}%m:%f%1~%f%F{cyan}|%#%f '
|
||||||
|
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
bindkey '^[[H' beginning-of-line
|
||||||
|
bindkey '^[[F' end-of-line
|
||||||
|
bindkey '^[[3~' delete-char
|
||||||
|
|
||||||
|
# Text art on clear/new shell
|
||||||
|
art_cat='%F{#fe8019}/\_,_/\
|
||||||
|
\ 0 0 /%f'
|
||||||
|
art_dog=' %F{#d79921}/___/
|
||||||
|
| 6.6 |%f'
|
||||||
|
art_bear='%F{#d65d0e}() ()
|
||||||
|
(o.o)%f'
|
||||||
|
art_snail=' %F{#689d6a}|_/
|
||||||
|
/o o\%f'
|
||||||
|
art_bunny=' %F{#d5c4a1}/_/
|
||||||
|
|^.^|'
|
||||||
|
art_jellyfish='%F{#83a598}<===>
|
||||||
|
//|\\%f'
|
||||||
|
art_school=' %F{#fe8019}<°))>< %F{#fabd2f}><(((.>
|
||||||
|
%F{#8ec07c}><(((°> %F{#d3869b}><((((°>%f'
|
||||||
|
art_array=("$art_cat" "$art_dog" "$art_bear" "$art_snail" "$art_bunny" "$art_jellyfish" "$art_school")
|
||||||
|
print -Pr "$art_array[$((RANDOM%7+1))]"
|
||||||
|
function term_clear() {
|
||||||
|
clear
|
||||||
|
print -Pr "$art_array[$((RANDOM%7+1))]"
|
||||||
|
print -Pn $PS1
|
||||||
|
}
|
||||||
|
zle -N zsh-redraw term_clear
|
||||||
|
bindkey "^L" zsh-redraw
|
||||||
|
|
||||||
|
# Stock aliases
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fastfetch='fastfetch -c neofetch'
|
||||||
|
alias unmv='setopt shwordsplit && lastCmdSplit=(${(@s/ /)$(fc -ln -1)}) && newCmd="mv ${lastCmdSplit[3]} ${lastCmdSplit[2]}" && $newCmd && unsetopt shwordsplit'
|
||||||
|
alias orphans='doas pacman -Rcns $(pacman -Qqdt)'
|
||||||
|
alias powersave='doas /usr/local/bin/powerset.sh powersave'
|
||||||
|
alias performance='doas /usr/local/bin/powerset.sh performance'
|
||||||
|
alias schedutil='doas /usr/local/bin/powerset.sh schedutil'
|
||||||
|
alias poweroff='doas /usr/bin/poweroff'
|
||||||
|
alias reboot='doas /usr/bin/reboot'
|
||||||
|
`
|
||||||
|
|||||||
+6
-70
@@ -7,7 +7,7 @@ import (
|
|||||||
func configurations() {
|
func configurations() {
|
||||||
for {
|
for {
|
||||||
var doAll bool
|
var doAll bool
|
||||||
choice := front.InputMenuGen("Custom config:", []string{"BACK", "ALL", "shell profile", "zshrc", "neovim", "zed", "makepkg", "pacman"})
|
choice := front.InputMenuGen("Custom config:", []string{"BACK", "ALL", "shell profile", "neovim", "zed", "makepkg", "pacman"})
|
||||||
switch choice {
|
switch choice {
|
||||||
case 1:
|
case 1:
|
||||||
return
|
return
|
||||||
@@ -15,7 +15,7 @@ func configurations() {
|
|||||||
doAll = true
|
doAll = true
|
||||||
fallthrough
|
fallthrough
|
||||||
case 3:
|
case 3:
|
||||||
managePackage("-S", "wayland-protocols")
|
managePackages("-S", []string{"wayland-protocols"})
|
||||||
writeFile(mountPoint+"/home/"+getUsername()+"/.profile", shellProfile, getUsername(), 0644)
|
writeFile(mountPoint+"/home/"+getUsername()+"/.profile", shellProfile, getUsername(), 0644)
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
@@ -23,20 +23,13 @@ func configurations() {
|
|||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 4:
|
case 4:
|
||||||
writeFile(mountPoint+"/home/"+getUsername()+"/.zshrc", zshrc, getUsername(), 0644)
|
|
||||||
|
|
||||||
if !doAll {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
fallthrough
|
|
||||||
case 5:
|
|
||||||
writeFile(mountPoint+"/etc/xdg/nvim/sysinit.vim", sysinitVim, "root", 0644)
|
writeFile(mountPoint+"/etc/xdg/nvim/sysinit.vim", sysinitVim, "root", 0644)
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 6:
|
case 5:
|
||||||
mkdir(mountPoint + "/home/" + getUsername() + "/.config/zed")
|
mkdir(mountPoint + "/home/" + getUsername() + "/.config/zed")
|
||||||
writeFile(mountPoint+"/home/"+getUsername()+"/.config/zed/settings.json", zed, getUsername(), 0600)
|
writeFile(mountPoint+"/home/"+getUsername()+"/.config/zed/settings.json", zed, getUsername(), 0600)
|
||||||
|
|
||||||
@@ -44,15 +37,15 @@ func configurations() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 7:
|
case 6:
|
||||||
writeFile(mountPoint+"/etc/makepkg.conf", makepkg, "root", 0644)
|
writeFile(mountPoint+"/etc/makepkg.conf", makepkg, "root", 0644)
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case 8:
|
case 7:
|
||||||
managePackage("-S", "pacman-contrib")
|
managePackages("-S", []string{"pacman-contrib"})
|
||||||
writeFile(mountPoint+"/etc/pacman.conf", pacman, "root", 0644)
|
writeFile(mountPoint+"/etc/pacman.conf", pacman, "root", 0644)
|
||||||
writeFile(mountPoint+"/etc/pacman.d/hooks/paccache-clean.hook", pacmanHookClean, "root", 0644)
|
writeFile(mountPoint+"/etc/pacman.d/hooks/paccache-clean.hook", pacmanHookClean, "root", 0644)
|
||||||
writeFile(mountPoint+"/etc/pacman.d/hooks/nvidia.hook", pacmanHookNvidia, "root", 0644)
|
writeFile(mountPoint+"/etc/pacman.d/hooks/nvidia.hook", pacmanHookNvidia, "root", 0644)
|
||||||
@@ -100,63 +93,6 @@ export SHELL=/usr/bin/zsh
|
|||||||
export BUILDDIR=/tmp/makepkg
|
export BUILDDIR=/tmp/makepkg
|
||||||
`
|
`
|
||||||
|
|
||||||
const zshrc = `# Shell settings
|
|
||||||
HISTFILE="$XDG_CACHE_HOME"/zsh-histfile
|
|
||||||
HISTSIZE=2500
|
|
||||||
SAVEHIST=2000
|
|
||||||
setopt INC_APPEND_HISTORY
|
|
||||||
setopt HIST_EXPIRE_DUPS_FIRST
|
|
||||||
setopt HIST_FIND_NO_DUPS
|
|
||||||
unsetopt beep
|
|
||||||
bindkey -e
|
|
||||||
zstyle :compinstall filename "/home/$USER/.zshrc"
|
|
||||||
autoload -Uz compinit
|
|
||||||
compinit -d "$XDG_CACHE_HOME"/zcompdump
|
|
||||||
PS1='%F{yellow}%?%F{cyan}|%n%f@%F{cyan}%m:%f%1~%f%F{cyan}|%#%f '
|
|
||||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
||||||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
|
||||||
bindkey '^[[H' beginning-of-line
|
|
||||||
bindkey '^[[F' end-of-line
|
|
||||||
bindkey '^[[3~' delete-char
|
|
||||||
|
|
||||||
# Text art on clear/new shell
|
|
||||||
art_cat='%F{#fe8019}/\_,_/\
|
|
||||||
\ 0 0 /%f'
|
|
||||||
art_dog=' %F{#d79921}/___/
|
|
||||||
| 6.6 |%f'
|
|
||||||
art_bear='%F{#d65d0e}() ()
|
|
||||||
(o.o)%f'
|
|
||||||
art_snail=' %F{#689d6a}|_/
|
|
||||||
/o o\%f'
|
|
||||||
art_bunny=' %F{#d5c4a1}/_/
|
|
||||||
|^.^|'
|
|
||||||
art_jellyfish='%F{#83a598}<===>
|
|
||||||
//|\\%f'
|
|
||||||
art_school=' %F{#fe8019}<°))>< %F{#fabd2f}><(((.>
|
|
||||||
%F{#8ec07c}><(((°> %F{#d3869b}><((((°>%f'
|
|
||||||
art_array=("$art_cat" "$art_dog" "$art_bear" "$art_snail" "$art_bunny" "$art_jellyfish" "$art_school")
|
|
||||||
print -Pr "$art_array[$((RANDOM%7+1))]"
|
|
||||||
function term_clear() {
|
|
||||||
clear
|
|
||||||
print -Pr "$art_array[$((RANDOM%7+1))]"
|
|
||||||
print -Pn $PS1
|
|
||||||
}
|
|
||||||
zle -N zsh-redraw term_clear
|
|
||||||
bindkey "^L" zsh-redraw
|
|
||||||
|
|
||||||
# Stock aliases
|
|
||||||
alias ls='ls --color=auto'
|
|
||||||
alias grep='grep --color=auto'
|
|
||||||
alias fastfetch='fastfetch -c neofetch'
|
|
||||||
alias unmv='setopt shwordsplit && lastCmdSplit=(${(@s/ /)$(fc -ln -1)}) && newCmd="mv ${lastCmdSplit[3]} ${lastCmdSplit[2]}" && $newCmd && unsetopt shwordsplit'
|
|
||||||
alias orphans='doas pacman -Rcns $(pacman -Qqdt)'
|
|
||||||
alias powersave='doas /usr/local/bin/powerset.sh powersave'
|
|
||||||
alias performance='doas /usr/local/bin/powerset.sh performance'
|
|
||||||
alias schedutil='doas /usr/local/bin/powerset.sh schedutil'
|
|
||||||
alias poweroff='doas /usr/bin/poweroff'
|
|
||||||
alias reboot='doas /usr/bin/reboot'
|
|
||||||
`
|
|
||||||
|
|
||||||
const sysinitVim = `" rwinkhart/cachyos-postinstall-helper 09/28/2025
|
const sysinitVim = `" rwinkhart/cachyos-postinstall-helper 09/28/2025
|
||||||
|
|
||||||
" ensure correct basic settings
|
" ensure correct basic settings
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ func cosmic() {
|
|||||||
manageService("stop", "sddm.service")
|
manageService("stop", "sddm.service")
|
||||||
manageService("disable", "sddm.service")
|
manageService("disable", "sddm.service")
|
||||||
manageService("enable", "greetd.service")
|
manageService("enable", "greetd.service")
|
||||||
managePackage("-Rcns", "sddm")
|
managePackages("-Rcns", []string{"sddm"})
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ func removals() {
|
|||||||
target = "linux-cachyos-lts"
|
target = "linux-cachyos-lts"
|
||||||
}
|
}
|
||||||
if !doAll {
|
if !doAll {
|
||||||
managePackage("-Rcns", target)
|
managePackages("-Rcns", []string{target})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ func system() {
|
|||||||
fallthrough
|
fallthrough
|
||||||
case 3:
|
case 3:
|
||||||
writeFile(mountPoint+"/etc/doas.conf", "permit persist keepenv :wheel as root\n", "root", 0644)
|
writeFile(mountPoint+"/etc/doas.conf", "permit persist keepenv :wheel as root\n", "root", 0644)
|
||||||
managePackage("-S", "opendoas")
|
managePackages("-S", []string{"opendoas"})
|
||||||
chrootCommandRun([]string{"pacman", "-S", "--asexplicit", "--dbonly", "archlinux-keyring", "autoconf", "automake", "binutils", "bison", "debugedit", "fakeroot", "file", "findutils", "flex", "gawk", "gcc", "gettext", "grep", "groff", "gzip", "libtool", "m4", "make", "pacman", "patch", "pkgconf", "sed", "texinfo", "which", "--noconfirm"})
|
managePackages("-S", []string{"--asexplicit", "--dbonly", "archlinux-keyring", "autoconf", "automake", "binutils", "bison", "debugedit", "fakeroot", "file", "findutils", "flex", "gawk", "gcc", "gettext", "grep", "groff", "gzip", "libtool", "m4", "make", "pacman", "patch", "pkgconf", "sed", "texinfo", "which"})
|
||||||
chrootCommandRun([]string{"pacman", "-R", "base-devel", "sudo", "--noconfirm"})
|
managePackages("-R", []string{"base-devel", "sudo"})
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
|
|||||||
+2
-2
@@ -15,8 +15,8 @@ func manageService(action, service string) {
|
|||||||
chrootCommandRun([]string{"systemctl", action, service})
|
chrootCommandRun([]string{"systemctl", action, service})
|
||||||
}
|
}
|
||||||
|
|
||||||
func managePackage(action, targetPackage string) {
|
func managePackages(action string, targetPackages []string) {
|
||||||
chrootCommandRun([]string{"pacman", action, targetPackage, "--noconfirm"})
|
chrootCommandRun(append([]string{"pacman", action, "--noconfirm"}, targetPackages...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeFile(path, data, owner string, perms os.FileMode) {
|
func writeFile(path, data, owner string, perms os.FileMode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user