Browse Source

Create user config section and cleanup dotfiles.sh

master
Riyyi 6 years ago
parent
commit
fadc9f0b7a
  1. 28
      dotfiles.sh

28
dotfiles.sh

@ -1,14 +1,19 @@
#!/bin/sh #!/bin/sh
# User-config--------------------------------
PACKAGE_FILE="packages"
EXCLUDE_FILES=".git|${0#??}|$PACKAGE_FILE|.*.md$|screenshot.png"
# -------------------------------------------
if [ "$(dirname "$0")" != "." ]; then if [ "$(dirname "$0")" != "." ]; then
echo "Please run this script from the directory it resides." echo "Please run this script from the directory it resides."
exit exit
fi fi
PACKAGE_FILE="./packages" FILES="$(find . -type f \
| awk -v e="^($EXCLUDE_FILES)" 'substr($0, 3) !~ e { print $0 }')"
EXCLUDE="./.git|$0|$PACKAGE_FILE|./README.md|./screenshot.png"
FILES="$(find . -type f | awk -v e="^($EXCLUDE)" '$0 !~ e { print $0 }')"
help() { help() {
B=$(tput bold) B=$(tput bold)
@ -54,10 +59,7 @@ list() {
} }
get() { get() {
if [ "$1" = "" ]; then [ "$1" = "" ] && return 1
echo "Missing argument <filepath>"
return
fi
FILE=$(readlink -f "$1") FILE=$(readlink -f "$1")
FILE_CUT_HOME="$(echo "$FILE" | sed -nr 's/^\/home\/'"$USER"'\/(.*)$/\1/p')" FILE_CUT_HOME="$(echo "$FILE" | sed -nr 's/^\/home\/'"$USER"'\/(.*)$/\1/p')"
@ -73,10 +75,8 @@ get() {
fi fi
} }
pullpush() { pull_push() {
if [ "$1" = "" ]; then [ "$1" = "" ] && return 1
return
fi
for f in $FILES; do for f in $FILES; do
# Remove the first character (.) from the string # Remove the first character (.) from the string
@ -103,11 +103,11 @@ pullpush() {
} }
pull() { pull() {
pullpush "pull" pull_push "pull"
} }
push() { push() {
pullpush "push" pull_push "push"
} }
packages() { packages() {

Loading…
Cancel
Save