Add initial installation script.

master
Icedream 2018-02-17 18:19:24 +01:00
parent 6fe586d33a
commit 501fb4cd64
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 39 additions and 0 deletions

39
install.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh -e
install_dotfiles() {
local target_dir="$1"
for d in dotfiles/*; do
cp -v "$d" "${target_dir}/$(basename "$d")"
done
}
install_files() {
local target_dir="$1"
local source_dir="${2:-.}"
if [ ! -d "${source_dir}" ]; then
echo "Source directory ${source_dir} does not exist, skipping."
return
fi
(
cd "${source_dir}"
for f in *; do
case "$f" in
^dotfiles)
install_dotfiles "${target_dir}"
;;
*)
if [ -d "$f" ]; then
(cd "$d" && install_files "${target_dir}/$f")
else
cp -v "$f" "${target_dir}"
fi
;;
esac
done
)
}
###
install_files "${HOME}" home
install_files "/etc" etc