Compare commits

..

No commits in common. "96b48e45ee0b2fde9c7e74c624c3348e0bb29f95" and "501fb4cd64d8660b185415747dcc5dc66853493a" have entirely different histories.

2 changed files with 13 additions and 29 deletions

View File

@ -1 +0,0 @@
.pacmanbin = "/usr/bin/powerpill"

View File

@ -1,46 +1,31 @@
#!/bin/sh -e #!/bin/sh -e
install_dotfiles() {
local target_dir="$1"
for d in dotfiles/*; do
cp -v "$d" "${target_dir}/$(basename "$d")"
done
}
install_files() { install_files() {
local target_dir="$1" local target_dir="$1"
local source_dir="$(readlink -f "${2:-.}")" local source_dir="${2:-.}"
local target_filename_prefix="${3}"
mkdir -vp "${target_dir}"
target_dir="$(readlink -f "${target_dir}")"
if [ ! -d "${source_dir}" ]; then if [ ! -d "${source_dir}" ]; then
echo "Source directory ${source_dir} does not exist, skipping." echo "Source directory ${source_dir} does not exist, skipping."
return return
fi fi
( (
cd "${source_dir}" cd "${source_dir}"
for f in "${source_dir}"/*; do for f in *; do
case "$(basename "$f")" in case "$f" in
dotfiles) ^dotfiles)
install_files "${target_dir}" "$f" . install_dotfiles "${target_dir}"
;;
*.jq)
tmpfile="$(mktemp)"
if [ -f "$f" ]; then
tmpfile="$(mktemp)"
target_file="${target_dir}/$(basename "$f" .jq)"
if [ -f "$target_file" ]; then
cat "$target_file"
else
echo "{}"
fi | jq "$(cat "$f")" > "$tmpfile"
mv -v "$tmpfile" "$target_file"
else
echo "Expected source file with .jq extension not to be a directory."
exit 1
fi
;; ;;
*) *)
if [ -d "$f" ]; then if [ -d "$f" ]; then
install_files "${target_dir}/${target_filename_prefix}$(basename "$f")" "$f" (cd "$d" && install_files "${target_dir}/$f")
else else
cp -v "$f" "${target_dir}/${target_filename_prefix}$(basename "$f")" cp -v "$f" "${target_dir}"
fi fi
;; ;;
esac esac