cleanup, bugfix, symlinks functionality
This commit is contained in:
parent
6c78d63c28
commit
e658f1ec4f
3 changed files with 24 additions and 8 deletions
30
bootstrap.sh
30
bootstrap.sh
|
@ -80,7 +80,7 @@ setup() {
|
|||
|
||||
install_packages() {
|
||||
#shellcheck disable=SC2016,SC2046
|
||||
xbps-install -y $(sed '/^[[:space:]]*#/d;/^$/d' packages.txt | xargs) 2>&1 | grep -q "not found in repository pool." && error "Invalid package in packages.txt, run validate.sh"
|
||||
xbps-install -y $(sed '/^[[:space:]]*#/d;/^$/d' "${SCRIPT_DIR}/packages.txt" | xargs) 2>&1 | grep -q "not found in repository pool." && error "Invalid package in packages.txt, run validate.sh"
|
||||
info "Done!"
|
||||
command -v git 1>/dev/null 2>&1 || error "git isn't installed even though it should be!"
|
||||
command -v stow 1>/dev/null 2>&1 || error "stow isn't installed even though it should be!"
|
||||
|
@ -94,6 +94,19 @@ install_files() {
|
|||
info "Done!"
|
||||
}
|
||||
|
||||
create_symlinks() {
|
||||
#shellcheck disable=SC2016
|
||||
_loop_wrapper "${SCRIPT_DIR}/symlinks.txt" \
|
||||
'Creating symlink $(echo $x | cut -d',' -f1) -> $(echo $x | cut -d',' -f2)' \
|
||||
'
|
||||
source=$(echo $x | cut -d"," -f2)
|
||||
target=$(echo $x | cut -d"," -f1)
|
||||
[ -L $target ] && rm $target
|
||||
ln -s $source $target
|
||||
'
|
||||
|
||||
}
|
||||
|
||||
create_user() {
|
||||
failed=false
|
||||
while ! echo "$username" | grep "^[a-z_][a-z0-9_-]*$" | grep -qv "root"; do
|
||||
|
@ -130,7 +143,7 @@ create_user() {
|
|||
|
||||
create_directories() {
|
||||
#shellcheck disable=SC2016
|
||||
_loop_wrapper "$1" \
|
||||
_loop_wrapper "${SCRIPT_DIR}/directories.txt" \
|
||||
'Creating directory $(echo $x | cut -d"," -f1)' \
|
||||
'
|
||||
dir=$(echo $x | cut -d"," -f1)
|
||||
|
@ -166,10 +179,10 @@ select_keymap() {
|
|||
|
||||
enable_services() {
|
||||
for sv in /var/service/*; do
|
||||
grep -qx "$(basename "$sv")" services.txt || rm "$sv"
|
||||
grep -qx "$(basename "$sv")" "${SCRIPT_DIR}/services.txt" || rm "$sv"
|
||||
done
|
||||
# shellcheck disable=2016
|
||||
_loop_wrapper "$1" \
|
||||
_loop_wrapper "${SCRIPT_DIR}/services.txt" \
|
||||
'Enabling ${x} service' \
|
||||
'[ ! -L /var/service/${x} ] && ln -s "/etc/sv/${x}" "/var/service/"'
|
||||
info "Done!"
|
||||
|
@ -189,11 +202,14 @@ check_root
|
|||
emphasize "-- Copying Files --"
|
||||
install_files
|
||||
|
||||
emphasize "-- Creating Symlinks --"
|
||||
create_symlinks
|
||||
|
||||
emphasize "-- Preparing Installation --"
|
||||
setup
|
||||
|
||||
emphasize "-- Installing Packages --"
|
||||
install_packages "${SCRIPT_DIR}/packages.txt"
|
||||
install_packages
|
||||
|
||||
username="$SUDO_USER"
|
||||
if [ -z "$username" ]; then
|
||||
|
@ -204,14 +220,14 @@ else
|
|||
fi
|
||||
|
||||
emphasize "-- Creating Standard Home Directories --"
|
||||
create_directories "${SCRIPT_DIR}/directories.txt"
|
||||
create_directories
|
||||
|
||||
emphasize "-- Installing Dotfiles --"
|
||||
install_dotfiles
|
||||
select_keymap
|
||||
|
||||
emphasize "-- Enabling Services --"
|
||||
enable_services "${SCRIPT_DIR}/services.txt"
|
||||
enable_services
|
||||
|
||||
emphasize "-- Finalizing Installation --"
|
||||
finalize
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/usr/bin/pinentry-gnome3
|
1
symlinks.txt
Normal file
1
symlinks.txt
Normal file
|
@ -0,0 +1 @@
|
|||
/usr/bin/pinentry,pinentry-gnome3
|
Reference in a new issue