2020-12-17 23:10:52 +01:00
|
|
|
#!/bin/sh
|
2016-04-28 08:00:21 +02:00
|
|
|
|
2020-12-17 23:10:52 +01:00
|
|
|
# make.sh
|
2020-07-04 22:32:01 +02:00
|
|
|
# Copyright 2016 Christian Baer
|
|
|
|
# https://git.debilux.org/chbaerr/dotfiles
|
2016-04-28 08:00:21 +02:00
|
|
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
# a copy of this software and associated documentation files (the
|
|
|
|
# "Software"), to deal in the Software without restriction, including
|
|
|
|
# without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
# permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
# the following conditions:
|
|
|
|
|
|
|
|
# The above copyright notice and this permission notice shall be
|
|
|
|
# included in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTI
|
|
|
|
|
2021-01-23 23:04:55 +01:00
|
|
|
exclude="README.md|init|Makefile|screenshot.png|.png|.git|.gitignore|.gitmodules|.gitsecret|.DS_Store|make.sh"
|
2016-04-28 08:00:21 +02:00
|
|
|
|
2020-12-17 23:10:52 +01:00
|
|
|
self=`basename -- "$0"`
|
2020-07-04 22:22:47 +02:00
|
|
|
basedir=`dirname "$0"`
|
2016-04-28 08:00:21 +02:00
|
|
|
|
|
|
|
# Show help screen
|
|
|
|
# Usage: help exitcode
|
|
|
|
help () {
|
2020-12-17 23:10:52 +01:00
|
|
|
echo "Usage: ${self} command {params}"
|
2016-04-28 08:00:21 +02:00
|
|
|
echo
|
2020-12-17 23:10:52 +01:00
|
|
|
echo "list List all files that will be copied"
|
|
|
|
echo "update Update the git repo and the included submodules"
|
|
|
|
echo "deploy Copy the files to ~"
|
|
|
|
echo "install Update and deploy these dotfiles"
|
|
|
|
echo "help Show this screen"
|
2016-04-28 08:00:21 +02:00
|
|
|
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Update git repo and submodules
|
|
|
|
# Usage: df_update
|
|
|
|
df_update () {
|
2020-07-04 22:22:47 +02:00
|
|
|
echo "#### Updating git repos and submodules"
|
2020-12-17 23:10:52 +01:00
|
|
|
git pull origin
|
2016-04-28 08:00:21 +02:00
|
|
|
git submodule init
|
|
|
|
git submodule update
|
2020-12-17 23:10:52 +01:00
|
|
|
git submodule foreach git pull origin
|
2016-04-28 08:00:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Deploy files to ~
|
|
|
|
# Usage: df_deploy
|
|
|
|
df_deploy () {
|
2020-11-29 12:25:26 +01:00
|
|
|
|
|
|
|
list_dirs=$(find . -type d | cut -d "/" -f 2- | grep -vE "${exclude}")
|
|
|
|
list_files=$(find . -type f | cut -d "/" -f 2- | grep -vE "${exclude}")
|
|
|
|
|
|
|
|
for dir in ${list_dirs}; do
|
|
|
|
mkdir -p ${HOME}/${dir}
|
|
|
|
done
|
|
|
|
|
|
|
|
for file in ${list_files}; do
|
|
|
|
cp -f ${file} ${HOME}/${file}
|
|
|
|
done
|
2016-04-28 08:00:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# List files that will be copied
|
|
|
|
# Usage: df_list
|
|
|
|
df_list () {
|
|
|
|
find . -print | grep -vE "$exclude"
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
######################## bootstrap.sh HELP ########################
|
|
|
|
help)
|
|
|
|
help 0
|
|
|
|
;;
|
|
|
|
######################## bootstrap.sh LIST ########################
|
|
|
|
list)
|
2020-07-04 22:22:47 +02:00
|
|
|
# Lists all files in repo, except those specified in $exclude"
|
2016-04-28 08:00:21 +02:00
|
|
|
df_list
|
|
|
|
;;
|
|
|
|
######################## bootstrap.sh DEPLOY ########################
|
|
|
|
deploy)
|
|
|
|
|
|
|
|
df_deploy
|
2020-05-11 18:17:33 +02:00
|
|
|
;;
|
2016-04-28 08:00:21 +02:00
|
|
|
######################## bootstrap.sh UPDATE ########################
|
|
|
|
update)
|
2020-07-04 22:22:47 +02:00
|
|
|
|
2016-04-28 08:00:21 +02:00
|
|
|
df_update
|
2020-05-11 18:17:33 +02:00
|
|
|
;;
|
2016-04-28 08:00:21 +02:00
|
|
|
######################## bootstrap.sh INSTALL ########################
|
|
|
|
install)
|
|
|
|
df_update
|
|
|
|
df_deploy
|
2020-05-11 18:17:33 +02:00
|
|
|
;;
|
2016-04-28 08:00:21 +02:00
|
|
|
*)
|
|
|
|
help 1
|
2020-05-11 18:17:33 +02:00
|
|
|
;;
|
2018-12-28 23:51:01 +01:00
|
|
|
esac
|