aboutsummaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-03-26 11:24:31 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-03-26 11:24:31 +0200
commit0e24383d706a91bc9536b1c0827e4209679ce009 (patch)
tree8d5619d2b6a1215430eeaf32b8540dd6f0ec7b8c /install.sh
parent62c1754d67319a726f29814ae717d0148df6c727 (diff)
downloaddotfiles-0e24383d706a91bc9536b1c0827e4209679ce009.tar.gz
install: some reafactoring
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh23
1 files changed, 7 insertions, 16 deletions
diff --git a/install.sh b/install.sh
index e0dbff0..75f4c3c 100755
--- a/install.sh
+++ b/install.sh
@@ -9,8 +9,6 @@ function fail(){
WORKDIR=$(realpath "$(dirname "$0")")
cd "$WORKDIR" || fail 1 "The working directory could not be determined."
-echo "Working in $WORKDIR"
-echo "Homedir is $HOME"
# For hooks
export WORKDIR
@@ -21,6 +19,9 @@ for f in lib/*.sh; do
source "$f" || fail 1 "Failed to load $f"
done
+debug "Working in $WORKDIR"
+debug "Homedir is $HOME"
+
if [ ! -f "config.csv" ] || [ ! -f "sets.csv" ]; then
# TODO Create them
fail 1 "Configuration files do not exist"
@@ -41,17 +42,7 @@ done < sets.csv
unset SET PKGS
if [ $# -eq 0 ]; then
- cat << EOF
-USAGE: $0 COMMAND [ARGS]
-COMMANDS
- install [CONFIG ...]
- install configurations. if none are provided,
- a selection menu is showm.
- add PATH
- Add PATH to managed configs
- hook HOOK
- manually call a hook
-EOF
+ print_help "$0"
exit 1
fi
@@ -84,10 +75,10 @@ case $CMD in
cp -r "$1" ./ || fail 1 "Failed to copy configuration"
echo "$NAME;$RELPATH" >> config.csv
- # This would need a reload
- #choose_target "$NAME"
- echo "Config was isntalled successfully."
+ call_hook post_add "$NAME" "$TARGET"
+
+ echo "Config was installed successfully."
echo "It can now be installed with $0 install $NAME"
echo "The following files were changed: config.csv $NAME"
;;