Add initial installation script.
parent
6fe586d33a
commit
501fb4cd64
|
@ -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
|
Loading…
Reference in New Issue