Finish up
This commit is contained in:
parent
e3be917eaf
commit
2243052b3d
@ -51,7 +51,7 @@ readonly NORM
|
|||||||
|
|
||||||
### VARS ###
|
### VARS ###
|
||||||
CUR_PHASE=1
|
CUR_PHASE=1
|
||||||
MAX_PHASE=3
|
MAX_PHASE=4
|
||||||
|
|
||||||
### INFO ###
|
### INFO ###
|
||||||
AVAILABLE_PLATFORMS='Both BIOS and UEFI systems\nOnly x86_64 systems\nDistros:\nArch\nArtix (OpenRC)\n'
|
AVAILABLE_PLATFORMS='Both BIOS and UEFI systems\nOnly x86_64 systems\nDistros:\nArch\nArtix (OpenRC)\n'
|
||||||
@ -241,13 +241,15 @@ setup_network() {
|
|||||||
echo "::1 localhost" >> /mnt/etc/hosts
|
echo "::1 localhost" >> /mnt/etc/hosts
|
||||||
echo "127.0.1.1 $MACHINE_HOSTNAME.localdomain $MACHINE_HOSTNAME" >> /mnt/etc/hosts
|
echo "127.0.1.1 $MACHINE_HOSTNAME.localdomain $MACHINE_HOSTNAME" >> /mnt/etc/hosts
|
||||||
|
|
||||||
|
quiet right_chroot /mnt pacman -S dhcpcd wpa_supplicant
|
||||||
if [ "$DISTRO" = "artix" ]; then
|
if [ "$DISTRO" = "artix" ]; then
|
||||||
if [ "$INIT_SYS" = "openrc-init" ]; then
|
if [ "$INIT_SYS" = "openrc-init" ]; then
|
||||||
echo "hostname=\"$MACHINE_HOSTNAME\"" > /mnt/etc/conf.d/hostname
|
echo "hostname=\"$MACHINE_HOSTNAME\"" > /mnt/etc/conf.d/hostname
|
||||||
quiet right_chroot /mnt pacman -S connman-openrc
|
quiet right_chroot /mnt pacman -S connman-openrc
|
||||||
quiet right_chroot /mnt rc-update add connmand
|
quiet right_chroot /mnt rc-update add connmand
|
||||||
fi
|
fi
|
||||||
quiet right_chroot /mnt pacman -S dhcpcd wpa_supplicant
|
else
|
||||||
|
quiet right_chroot /mnt systemctl enable dhcpcd
|
||||||
fi
|
fi
|
||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
@ -301,7 +303,8 @@ post_install() {
|
|||||||
chmod +x /mnt/root/post-install.sh
|
chmod +x /mnt/root/post-install.sh
|
||||||
echo -n "Ready for post-install script. Press any key to continue..."
|
echo -n "Ready for post-install script. Press any key to continue..."
|
||||||
read dummy
|
read dummy
|
||||||
right_chroot /mnt /root/post-install.sh
|
print_phase "Post installation"
|
||||||
|
right_chroot /mnt /root/post-install.sh -nu "$PERSONAL_USER"
|
||||||
}
|
}
|
||||||
|
|
||||||
configure() {
|
configure() {
|
||||||
|
70
packages.csv
70
packages.csv
@ -1,28 +1,42 @@
|
|||||||
,cmake
|
PAC,alsa-utils,Utilities for ALSA
|
||||||
,picom
|
PAC,clang,C compiler
|
||||||
,networkmanager
|
PAC,cmake,Meta-build system
|
||||||
,qutebrowser
|
PAC,cmus,Terminal music player
|
||||||
,unclutter
|
AUR,compiledb,Utility for generating compile_commands.json from Makefile
|
||||||
,lxsession
|
FUN,install_dash,
|
||||||
,mpv
|
FUN,install_doas,
|
||||||
,mupdf
|
PAC,dunst,Notification daemon
|
||||||
,fzf
|
SRC,https://github.com/augustogunsch/dmenu,Graphical dynamic menu
|
||||||
,go
|
SRC,https://github.com/augustogunsch/dwm,Tiling window manager
|
||||||
,unzip
|
SRC,https://github.com/augustogunsch/dwm-bar,Dwm status bar
|
||||||
,feh
|
PAC,feh,Image viewer
|
||||||
,openssh
|
PAC,firejail,Sandbox program
|
||||||
,git
|
PAC,fzf,Fuzzy finder
|
||||||
,scrot
|
PAC,gcc,C compiler
|
||||||
,tmux
|
PAC,git,Version control system
|
||||||
,zsh
|
PAC,go,Go compiler
|
||||||
,libxinerama
|
PAC,gvim,Text editor
|
||||||
,xorg-server
|
PAC,libnotify,Implementation of the Desktop Notifications Specification
|
||||||
,xorg-xinit
|
PAC,libxinerama,X11 extension which provides support for extending a desktop across multiple displays
|
||||||
,man
|
PAC,lxsession,Graphical authentication agent
|
||||||
,pulseaudio
|
PAC,man,Interface to system manuals
|
||||||
,pulseaudio-alsa
|
PAC,mpv,Media player
|
||||||
,pulsemixer
|
PAC,mupdf,Lightweight PDF viewer
|
||||||
,libnotify
|
PAC,openssh,Secure shell
|
||||||
,dunst
|
PAC,picom,X11 compositor
|
||||||
,xorg-xsetroot
|
PAC,polkit,Toolkit for handling the policy that allows unprivileged processes to speak to privileged ones
|
||||||
,pamixer
|
PAC,python3,Python 3 interpreter
|
||||||
|
PAC,qutebrowser,Web browser inspired with vi-styled keybindings
|
||||||
|
PAC,scrot,Screenshot-taking program
|
||||||
|
SRC,https://github.com/augustogunsch/st,Terminal emulator
|
||||||
|
PAC,thunar,Graphical file manager
|
||||||
|
PAC,tmux,Terminal multiplexer
|
||||||
|
PAC,unclutter,Program that hides the cursos if idle
|
||||||
|
PAC,unzip,ZIP file extractor
|
||||||
|
PAC,xdotool,Utility for automating X11 tasks
|
||||||
|
PAC,xorg-server,X11 server
|
||||||
|
PAC,xorg-xinit,X11 starter
|
||||||
|
PAC,xorg-xsetroot,X11 utility to set wallpapers
|
||||||
|
AUR,yay,AUR helper
|
||||||
|
PAC,zathura,PDF viewer with vi-styled keybindings
|
||||||
|
PAC,zsh,Shell
|
||||||
|
|
192
post-install.sh
192
post-install.sh
@ -13,9 +13,18 @@ quiet() {
|
|||||||
local DUMMY
|
local DUMMY
|
||||||
set +e
|
set +e
|
||||||
DUMMY=$($@ 2>&1 > /dev/null)
|
DUMMY=$($@ 2>&1 > /dev/null)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "$DUMMY"
|
||||||
|
set -e
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### URLs ###
|
||||||
|
DOTFILES="https://github.com/augustogunsch/dotfiles"
|
||||||
|
PACKAGES_URL="https://raw.githubusercontent.com/augustogunsch/install-arch/master/packages.csv"
|
||||||
|
|
||||||
### COLORS ###
|
### COLORS ###
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
LGREEN='\033[1;32m'
|
LGREEN='\033[1;32m'
|
||||||
@ -39,11 +48,11 @@ USER_OUT=""
|
|||||||
PACMAN_CONF="/etc/pacman.conf"
|
PACMAN_CONF="/etc/pacman.conf"
|
||||||
PACMAN_TEMP_CONF="/tmp/pacman.conf"
|
PACMAN_TEMP_CONF="/tmp/pacman.conf"
|
||||||
DOAS_CONF="/etc/doas.conf"
|
DOAS_CONF="/etc/doas.conf"
|
||||||
DISTRO=$(cat /etc/os-release | sed -nE 's/^ID=(.*)/\1/p')
|
DISTRO=$(sed -nE 's/^ID=(.*)/\1/p' < /etc/os-release)
|
||||||
INIT_SYS=$(basename $(readlink /bin/init))
|
INIT_SYS=$(basename $(readlink /bin/init))
|
||||||
DEFAULT_INCLUDE='/etc/pacman.d/mirrorlist'
|
DEFAULT_INCLUDE='/etc/pacman.d/mirrorlist'
|
||||||
if [ "$DISTRO" != "arch" -a "$DISTRO" != "artix" ]; then
|
if [ "$DISTRO" != "arch" -a "$DISTRO" != "artix" ]; then
|
||||||
echo "Error: $(lsb_release -ds) not supported"
|
echo "Error: $DISTRO not supported"
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
readonly PACMAN_CONF
|
readonly PACMAN_CONF
|
||||||
@ -106,8 +115,8 @@ shift $((OPTIND-1))
|
|||||||
[ -z "$INSTALL_USER" ] && [ "$INSTALL" != "PACKAGES" ] && echo "Error: <user> required" && usage
|
[ -z "$INSTALL_USER" ] && [ "$INSTALL" != "PACKAGES" ] && echo "Error: <user> required" && usage
|
||||||
|
|
||||||
check_user() {
|
check_user() {
|
||||||
HOMEDIR="$(cat /etc/passwd | awk -F: '$1 ~ /^'$1'$/ {print $6}')"
|
HOME_DIR="$(awk -F: '$1 ~ /^'$1'$/ {print $6}' < /etc/passwd)"
|
||||||
[ -z "$HOMEDIR" ] && echo "Error: User $1 does not exist" && return 1
|
[ -z "$HOME_DIR" ] && echo "Error: User $1 does not exist" && return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +148,7 @@ prompt_user() {
|
|||||||
if [ ! $NO_CONFIRM ]; then
|
if [ ! $NO_CONFIRM ]; then
|
||||||
echo "${BOLD}Please confirm operation:${NORM}"
|
echo "${BOLD}Please confirm operation:${NORM}"
|
||||||
echo -ne "Installing ${LGREEN}${INSTALL@L}${NC}"
|
echo -ne "Installing ${LGREEN}${INSTALL@L}${NC}"
|
||||||
[ -n "$INSTALL_USER" ] && echo -ne " for ${LGREEN}$INSTALL_USER ($HOMEDIR)${NC}"
|
[ -n "$INSTALL_USER" ] && echo -ne " for ${LGREEN}$INSTALL_USER ($HOME_DIR)${NC}"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
echo -n "Proceed with installation? [y/N] "
|
echo -n "Proceed with installation? [y/N] "
|
||||||
read ans
|
read ans
|
||||||
@ -158,27 +167,44 @@ print_phase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_aur() {
|
install_aur() {
|
||||||
dir="$HOMEDIR/$1"
|
[ -z "$INSTALL_USER" ] && return 0
|
||||||
echo -n "Installing $1... "
|
if [ -z "$2" ]; then
|
||||||
quiet sudo -u "$1" git clone -q "https://aur.archlinux.org/$1.git" "$dir"
|
echo -n "Installing $1 from AUR..."
|
||||||
qpushd -q "$dir"
|
else
|
||||||
quiet sudo -u "$1" makepkg -si --noconfirm
|
echo "Installing $1 from AUR. Description:"
|
||||||
qpopd -q
|
echo "$2"
|
||||||
rm -rf "$1"
|
fi
|
||||||
|
local dir="$HOME_DIR/$1"
|
||||||
|
quiet sudo -u "$INSTALL_USER" git clone -q "https://aur.archlinux.org/$1.git" "$dir"
|
||||||
|
qpushd "$dir"
|
||||||
|
quiet sudo -u "$INSTALL_USER" makepkg -si --noconfirm
|
||||||
|
qpopd
|
||||||
|
rm -rf "$dir"
|
||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove() {
|
remove() {
|
||||||
echo -n "Removing $1..."
|
echo -n "Removing $1..."
|
||||||
set +e
|
set +e
|
||||||
pacman -Rs --noconfirm $1 2>&1 > /dev/null
|
quiet pacman -Rs --noconfirm $1
|
||||||
set -e
|
set -e
|
||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
echo -n "Installing $1..."
|
if [ -z "$2" ]; then
|
||||||
pacman -Sq --needed --noconfirm $1 2>&1 > /dev/null
|
echo -n "Installing $1..."
|
||||||
|
else
|
||||||
|
echo "Installing $1. Description:"
|
||||||
|
echo "$2"
|
||||||
|
fi
|
||||||
|
set +e
|
||||||
|
quiet pacman -Sq --needed --noconfirm $1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
set -e
|
||||||
|
quiet pacman -Sqyu --needed --noconfirm $1
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,6 +401,7 @@ append_line() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configure_doas() {
|
configure_doas() {
|
||||||
|
[ -e /bin/doas ] || return 0
|
||||||
echo "Configuring doas..."
|
echo "Configuring doas..."
|
||||||
prompt_user 'doas will be configured'
|
prompt_user 'doas will be configured'
|
||||||
local DOAS_USER="$USER_OUT"
|
local DOAS_USER="$USER_OUT"
|
||||||
@ -386,20 +413,17 @@ configure_doas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_doas() {
|
install_doas() {
|
||||||
#install_aur requires sudo or doas
|
remove sudo
|
||||||
set +e
|
install opendoas "Sudo alternative"
|
||||||
prompt "Do you want to install doas (will remove sudo and forbid it in $PACMAN_CONF)?"
|
pacman_opt IgnorePkg sudo
|
||||||
if [ $? -eq 1 ]; then
|
pacman_opt NoUpgrade bin/sudo
|
||||||
set -e
|
link /bin/doas /bin/sudo
|
||||||
install sudo
|
}
|
||||||
install_aur doas
|
|
||||||
remove sudo
|
install_dash() {
|
||||||
pacman_opt IgnorePkg sudo
|
install dash "Lightweight POSIX shell"
|
||||||
pacman_opt NoUpgrade sudo
|
pacman_opt NoUpgrade bin/sh
|
||||||
link /bin/doas /bin/sudo
|
link /bin/dash /bin/sh
|
||||||
configure_doas
|
|
||||||
fi
|
|
||||||
set -e
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repos() {
|
repos() {
|
||||||
@ -416,25 +440,109 @@ repos() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_packages() {
|
# pwd must be the home dir of the user
|
||||||
if [ "$INSTALL" != "DOTFILES" ]; then
|
configure_vim_for() {
|
||||||
print_phase "Package installation"
|
echo -n "Downloading vim-plug for $1..."
|
||||||
repos
|
quiet sudo -u "$1" curl -sfLo .vim/autoload/plug.vim --create-dirs \
|
||||||
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
echo -n "Upgrading system... "
|
echo "done"
|
||||||
pacman -Sqyu --noconfirm 2>&1 > /dev/null
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
install_doas
|
echo -n "Installing vim plugins for $1..."
|
||||||
|
quiet sudo -u "$1" vim -E -c PlugInstall -c qall
|
||||||
|
echo "done"
|
||||||
|
}
|
||||||
|
|
||||||
install_aur yay
|
# pwd must be the home dir of the user
|
||||||
|
install_dotfiles_for() {
|
||||||
|
echo -n "Downloading dotfiles for $1 (~/dotfiles)..."
|
||||||
|
quiet sudo -u "$1" git clone "$DOTFILES" ./dotfiles
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Linking dotfiles..."
|
||||||
|
qpushd "./dotfiles"
|
||||||
|
quiet sudo -u "$1" ./install.sh
|
||||||
|
echo "done"
|
||||||
|
qpopd
|
||||||
|
}
|
||||||
|
|
||||||
|
install_dotfiles() {
|
||||||
|
[ "$INSTAL" = "PACKAGES" ] && return 0
|
||||||
|
|
||||||
|
print_phase "Dotfile installation"
|
||||||
|
install git
|
||||||
|
|
||||||
|
qpushd "$HOME_DIR"
|
||||||
|
install_dotfiles_for "$INSTALL_USER"
|
||||||
|
configure_vim_for "$INSTALL_USER"
|
||||||
|
qpopd
|
||||||
|
|
||||||
|
qpushd "$HOME"
|
||||||
|
install_dotfiles_for "root"
|
||||||
|
configure_vim_for "root"
|
||||||
|
qpopd
|
||||||
|
|
||||||
|
change_shells
|
||||||
|
}
|
||||||
|
|
||||||
|
install_src() {
|
||||||
|
# source code is stored in /root/builds
|
||||||
|
qpushd "$HOME"
|
||||||
|
local PKG_NAME="$(basename "$1")"
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
echo -n "Installing $PKG_NAME from source..."
|
||||||
|
else
|
||||||
|
echo "Installing $PKG_NAME from source. Description:"
|
||||||
|
echo "$2"
|
||||||
fi
|
fi
|
||||||
|
quiet git clone -q "$1"
|
||||||
|
qpushd "$PKG_NAME"
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
qpopd
|
||||||
|
qpopd
|
||||||
|
}
|
||||||
|
|
||||||
|
install_loop() {
|
||||||
|
[ -f "packages.csv" ] || curl -sL "$PACKAGES_URL" -o "packages.csv"
|
||||||
|
while IFS=, read -r method package description; do
|
||||||
|
case "$method" in
|
||||||
|
"PAC") install "$package" "$description";;
|
||||||
|
"AUR") install_aur "$package" "$description";;
|
||||||
|
"SRC") install_src "$package" "$description";;
|
||||||
|
"FUN") $package ;;
|
||||||
|
esac
|
||||||
|
done < packages.csv
|
||||||
|
}
|
||||||
|
|
||||||
|
install_packages() {
|
||||||
|
[ "$INSTALL" = "DOTFILES" ] && return 0
|
||||||
|
|
||||||
|
print_phase "Package installation"
|
||||||
|
|
||||||
|
echo -n "Upgrading system..."
|
||||||
|
quiet pacman -Sqyu --noconfirm
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
install_doas
|
||||||
|
install_dash
|
||||||
|
|
||||||
|
install_loop
|
||||||
|
}
|
||||||
|
|
||||||
|
change_shells() {
|
||||||
|
echo -n "Configuring zsh..."
|
||||||
|
chsh -s /bin/zsh "root"
|
||||||
|
chsh -s /bin/zsh "$INSTALL_USER"
|
||||||
|
sed 's/^export PROMPT=.*/export PROMPT='"'"'%B%F{166}[%F{172}%n@%m %F{white}%~%F{166}]$%b%f '"'"'/' < "$HOME/.zshrc" > /tmp/zshrc
|
||||||
|
mv /tmp/zshrc "$HOME/.zshrc"
|
||||||
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
#install_packages
|
repos
|
||||||
#configure_doas
|
install_packages
|
||||||
echo "POST INSTALL TEST"
|
install_dotfiles
|
||||||
|
configure_doas
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
Loading…
x
Reference in New Issue
Block a user