refactor bootstrap.sh
This commit is contained in:
parent
02f3e1b7d5
commit
9b6eee78f3
|
@ -65,7 +65,7 @@ check_root() {
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
info "Synchronizing XBPS index..."
|
info "Synchronizing XBPS index..."
|
||||||
xbps-install -S >/dev/null 2>&1 || error "Failed to synchronize XBPS index! (Try manually running xbps-install -S)"
|
xbps-install -S xbps void-repo-nonfree >/dev/null 2>&1 || error "Failed to synchronize XBPS index! (Try manually running xbps-install -S)"
|
||||||
|
|
||||||
if ! xbps-query ntp >/dev/null 2>&1; then
|
if ! xbps-query ntp >/dev/null 2>&1; then
|
||||||
info "Installing ntp..."
|
info "Installing ntp..."
|
||||||
|
@ -80,7 +80,7 @@ setup() {
|
||||||
|
|
||||||
install_packages() {
|
install_packages() {
|
||||||
#shellcheck disable=SC2016,SC2046
|
#shellcheck disable=SC2016,SC2046
|
||||||
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"
|
{ sed '/^[[:space:]]*#/d;/^$/d' "${SCRIPT_DIR}/packages.txt" | xargs -r xbps-install -y || error "Invalid package in packages.txt"; } | grep -v 'already installed'
|
||||||
info "Done!"
|
info "Done!"
|
||||||
command -v git 1>/dev/null 2>&1 || error "git isn't installed even though it should be!"
|
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!"
|
command -v stow 1>/dev/null 2>&1 || error "stow isn't installed even though it should be!"
|
||||||
|
@ -191,7 +191,7 @@ enable_services() {
|
||||||
finalize() {
|
finalize() {
|
||||||
gid=$(getent passwd "$username" | cut -d ':' -f 4)
|
gid=$(getent passwd "$username" | cut -d ':' -f 4)
|
||||||
groupname=$(getent group "$gid" | cut -d ':' -f 1)
|
groupname=$(getent group "$gid" | cut -d ':' -f 1)
|
||||||
chown "$username:$groupname" "$user_home"
|
chown "$username:$groupname" -R "$user_home"
|
||||||
info "Done!"
|
info "Done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue