added platform scripts...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-07-20 11:18:29 +03:00
parent 24f34ca7ca
commit 8757164335

View File

@ -30,6 +30,7 @@ USER_RC=~/.${CMD}rc
SCRIPT_DIR=${0}.d/ SCRIPT_DIR=${0}.d/
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# configuration.... # configuration....
@ -50,6 +51,7 @@ FEATURES=(
user-copy user-copy
scripts scripts
platform-scripts
) )
@ -67,6 +69,21 @@ DIR=(
~/work/EXTERNAL ~/work/EXTERNAL
) )
# NOTE: $DIR and these are not run in order -- linking may need other
# stuff done before...
# XXX
CFG_USER_SOURCE=~/Sync/CONFIG/Linux/
CFG_USER_LINK=(
.gitconfig
.vimrc .gvimrc .vim
.tmux.conf
.config/mc
.config/ulauncher
)
CFG_USER_COPY=(
)
PKG_DNF=( PKG_DNF=(
# tools and recovery... # tools and recovery...
@ -139,18 +156,6 @@ SERVICES_USER_START=(
) )
# XXX
CFG_USER_SOURCE=~/Sync/CONFIG/Linux/
CFG_USER_LINK=(
.gitconfig
.vimrc .gvimrc .vim
.tmux.conf
.config/mc
.config/ulauncher
)
CFG_USER_COPY=(
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -167,6 +172,35 @@ SAVE=(
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Builtin features... # Builtin features...
# default
# XXX this should be split into system and user sections...
ALL_FEATURES=(
# system...
dnf
flatpak
snap
npm
#keyd
start-services
# user..
dir
user-link
user-copy
#syncthing
start-user-services
# keep this last...
scripts
platform-scripts
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function feature-dir(){ function feature-dir(){
@setupList mkdir -p - ${DIR[@]} @setupList mkdir -p - ${DIR[@]}
@ -223,14 +257,14 @@ function feature-snap(){
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function feature-start-services(){ function feature-start-services(){
@setupList sudo systemctl start - ${SERVICES_START[@]}
@setupList sudo systemctl enable - ${SERVICES_START[@]} @setupList sudo systemctl enable - ${SERVICES_START[@]}
@setupList sudo systemctl --user enable - ${SERVICES_USER_START[@]}
} }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function feature-start-user-services(){ function feature-start-user-services(){
@setupList sudo systemctl start - ${SERVICES_START[@]} @setupList sudo systemctl --user enable - ${SERVICES_USER_START[@]}
@setupList sudo systemctl --user start - ${SERVICES_USER_START[@]} @setupList sudo systemctl --user start - ${SERVICES_USER_START[@]}
} }
@ -314,41 +348,50 @@ function feature-snapshots(){ (
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# XXX split these into:
# - system
# - machine -- get platform name
# - user
function feature-scripts(){ ( function feature-scripts(){ (
[ -d "$SCRIPT_DIR" ] \ if ! [ -z "$1" ] ; then
local dir=$1
else
local dir=$SCRIPT_DIR
fi
# no script dir...
[ -d "$dir" ] \
|| return 1 || return 1
cd "$SCRIPT_DIR" cd "$dir"l
local script
for script in * ; do for script in * ; do
echo "# $script:" echo "# $script:"
( @ ./$script ) ( @ ./$script )
done done
) } ) }
function feature-platform-scripts(){
# System info...
if ! [ -z "$(type -t dmidecode )" ] ; then
# XXX should we be more specific here and include model number??
local platform=$( dmidecode \
| grep -A3 '^System Information' \
| grep 'Version:' \
| sed 's/\s*Version:\s*//' )
else
local platform=default
fi
feature-scripts "$SCRIPT_DIR/$platform"
}
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# feature api... # feature api...
# default
ALL_FEATURES=(
dir
dnf
flatpak
snap
npm
start-services
start-user-services
user-link
user-copy
# keep this last...
scripts
)
function @feature(){ function @feature(){
while ! [ -z "$1" ] ; do while ! [ -z "$1" ] ; do
local feauture="$1" local feauture="$1"
@ -490,7 +533,7 @@ Available scripts:
Examples: Examples:
Only create dirs and links (features dir and user-link)... Only create dirs and links (features dir and user-link)...
\$ $CMD -all +die +user-link \$ $CMD -all +dir +user-link
Same as above... Same as above...
\$ FEATURES=( dir user-link ) $CMD \$ FEATURES=( dir user-link ) $CMD