updated build/setup to match scwrypts v3

This commit is contained in:
2023-06-27 18:30:02 -06:00
parent 1a64551465
commit dff8211b9d
11 changed files with 111 additions and 81 deletions

View File

@@ -2,11 +2,11 @@
SETUP__OS() {
OS__MAKE_REQUIRED_RESOURCES || return 1
[ $CI ] && { __STATUS 'detected CI; skipping os setup'; return 0; }
__GETSUDO
[ $CI ] && { STATUS 'detected CI; skipping os setup'; return 0; }
GETSUDO
local OS_NAME=$(OS__GET_OS)
[ ! $OS_NAME ] && __ABORT
[ ! $OS_NAME ] && ABORT
OS__INSTALL_SOURCE_DEPENDENCIES || return 2
OS__INSTALL_MANAGED_DEPENDENCIES || return 3
@@ -19,8 +19,8 @@ OS__GET_OS() {
&& OS_NAME=$(cat /etc/os-release 2>/dev/null | grep '^ID=' | sed 's/^ID=//')
[ ! $OS_NAME ] \
&& __WARNING 'failed to detect operating system' \
&& OS_NAME=$(echo -e "arch\ndebian\nother" | __FZF 'select an operating system') \
&& WARNING 'failed to detect operating system' \
&& OS_NAME=$(echo -e "arch\ndebian\nother" | FZF 'select an operating system') \
;
[[ $OS_NAME =~ ^ubuntu$ ]] && OS_NAME=debian
@@ -33,7 +33,7 @@ OS__GET_OS() {
OS__INSTALL_SOURCE_DEPENDENCIES() {
case $OS_NAME in
arch )
SCWRYPTS zsh/git/package/install \
SCWRYPTS packages/install \
'https://aur.archlinux.org/yay.git' \
--local-name 'yay' \
;
@@ -42,7 +42,7 @@ OS__INSTALL_SOURCE_DEPENDENCIES() {
* ) ;;
esac
SCWRYPTS zsh/git/package/install \
SCWRYPTS packages/install \
'https://github.com/tiyn/dmenu' \
--local-name 'patched-dmenu' \
;
@@ -53,15 +53,15 @@ OS__INSTALL_SOURCE_DEPENDENCIES() {
OS__INSTALL_MANAGED_DEPENDENCIES() {
local ERRORS=0
__STATUS 'checking os dependencies'
STATUS 'checking os dependencies'
case $OS_NAME in
arch )
__REMINDER "package 'base-devel' is required"
REMINDER "package 'base-devel' is required"
;;
debian ) ;;
* )
OS_NAME='generic'
__WARNING "no automated installer available for '$OS_NAME'"
WARNING "no automated installer available for '$OS_NAME'"
;;
esac
@@ -71,42 +71,42 @@ OS__INSTALL_MANAGED_DEPENDENCIES() {
done
[[ $ERRORS -ne 0 ]] && {
__WARNING "detected $ERRORS errors; double check warnings before proceeding!"
__yN 'continue with install?' && return 0 || __ABORT
WARNING "detected $ERRORS errors; double check warnings before proceeding!"
yN 'continue with install?' && return 0 || ABORT
}
__SUCCESS 'all dependencies satisfied'
SUCCESS 'all dependencies satisfied'
return 0
}
INSTALL_MANAGED__arch() {
local TARGET="$1"
__STATUS "checking for $TARGET"
STATUS "checking for $TARGET"
pacman -Qq | grep -q "^$TARGET$\|^$TARGET-git$" && {
__SUCCESS "found installation of '$TARGET'"
SUCCESS "found installation of '$TARGET'"
} || {
__WARNING "'$TARGET' not found"
WARNING "'$TARGET' not found"
__STATUS "installing '$TARGET'"
STATUS "installing '$TARGET'"
sudo pacman -Syu --noconfirm $TARGET \
&& __SUCCESS "successfully installed '$TARGET'" \
|| __ERROR "failed to install '$TARGET'"
&& SUCCESS "successfully installed '$TARGET'" \
|| ERROR "failed to install '$TARGET'"
}
}
INSTALL_MANAGED__debian() {
__STATUS "checking / installing '$1'"
STATUS "checking / installing '$1'"
sudo apt-get install --yes $1 \
&& __SUCCESS "'$1' installed" \
|| __ERROR "failed to install $TARGET" \
&& SUCCESS "'$1' installed" \
|| ERROR "failed to install $TARGET" \
;
}
INSTALL_MANAGED__generic() {
command -v $1 >/dev/null 2>&1 \
|| __ERROR "could not find '$1'; it's up to you to install this one!"
|| ERROR "could not find '$1'; it's up to you to install this one!"
}
#####################################################################
@@ -125,20 +125,20 @@ OS__MAKE_REQUIRED_RESOURCES() {
"$HOME/.zshrc"
)
__STATUS 'making required system resources'
STATUS 'making required system resources'
for D in $DIRECTORIES
do
[ ! -d $D ] && { mkdir -p $D || __ERROR "failed to create directory '$D'"; }
[ ! -d $D ] && { mkdir -p $D || ERROR "failed to create directory '$D'"; }
done
for F in $FILES
do
[ ! -f $F ] && { touch $F || __ERROR "failed to create file '$F'"; }
[ ! -f $F ] && { touch $F || ERROR "failed to create file '$F'"; }
done
[[ $ERRORS -eq 0 ]] \
&& __SUCCESS 'finished creating system resources' \
|| __ERROR 'failed to create system resources' \
&& SUCCESS 'finished creating system resources' \
|| ERROR 'failed to create system resources' \
;
return $ERRORS