#!/bin/sh -e if [ "$(uname -s)" = "Darwin" ]; then READLINK="greadlink" if ! command -v "${READLINK}" >/dev/null 2>&1; then READLINK="readlink" fi else READLINK="readlink" fi install_files() { target_dir="$1" source_dir="$("${READLINK}" -f "${2:-.}")" target_filename_prefix="${3}" mkdir -vp "${target_dir}" target_dir="$("${READLINK}" -f "${target_dir}")" if [ ! -d "${source_dir}" ]; then echo "Source directory ${source_dir} does not exist, skipping." return fi for f in "${source_dir}"/*; do case "$(basename "$f")" in dotfiles) (install_files "${target_dir}" "$f" .) ;; *.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 (install_files "${target_dir}/${target_filename_prefix}$(basename "$f")" "$f") else cp -v "$f" "${target_dir}/${target_filename_prefix}$(basename "$f")" fi ;; esac done } remove_file() { local path="$1" sha256hash="${2:-}" if [ ! -f "$path" ]; then return fi if [ -n "${sha256hash}" ] && ! sha256sum -c - <<< "${sha256hash} ${path}" >/dev/null 2>/dev/null; then return fi rm -v "$path" } ### install_files "${HOME}" home install_files "/etc" etc if command -v fc-cache >/dev/null 2>&1; then fc-cache -f fi if command -v systemctl >/dev/null 2>&1; then systemctl --user disable tweak-cpu-usage remove_file "${HOME}/.config/systemd/user/tweak-cpu-usage.service" 6abf4488aa268b0171cb400270e2531c8fb067ebe8216c72d337f8c056952f9e remove_file "${HOME}/.local/bin/tweak-cpu-usage" 7da1938cdf78e583140638848f8bf8a268c2710e4fa3462bca8373e438d67491 fi # KDE 6 if command -v kwriteconfig6 >/dev/null 2>&1; then # set sans font to what we define in fontconfig for key in "General:font" "General:menuFont" "General:toolBarFont" "WM:activeFont"; do IFS=: read group key <<<"$key" kwriteconfig6 --file kdeglobals --group "$group" --key "$key" "Sans Serif,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" done # set smallest sans font kwriteconfig6 --file kdeglobals --group "General" --key "smallestReadableFont" "Sans Serif,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" # set mono font to what we define in fontconfig kwriteconfig6 --file kdeglobals --group "General" --key "fixed" "Monospace,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" fi