4 [ "${*}" ] && printf "%s\n\n" "${*}"
6 Usage: fixskel [-c|-i|-r]
8 -c Check symlinks for sanity
12 This script will adjust the bash-config symlinks in /usr/share/skel
13 so that new users will be set up automatically. This is a companion
14 script to 'fixusers', which will set up existing users.
16 This script will avoid tampering with files that it thinks are
17 manually added. Use -c to check, and verify the files manually
24 files="bash_profile bashrc"
27 [ "${#}" -eq 0 ] && set - ${files}
31 skel="/usr/share/skel/dot.${file}"
32 real="/usr/local/etc/bash-config/${file}"
33 if [ ! -L "${skel}" ] || [ "$(realpath "$(readlink "${skel}")")" != "$(realpath "${real}")" ]
43 [ "${#}" -eq 0 ] && set - ${files}
47 skel="/usr/share/skel/dot.${file}"
48 [ -f "${skel}" ] && return 1
55 [ "${#}" -eq 0 ] && set - ${files}
61 echo "File ${file} does not exist."
65 echo "File ${file} is mine."
67 echo "File ${file} exists, but is not mine."
77 echo "Skel symlinks appear to be correct"
83 echo "Skel files (${files}) appear to exist, and are not mine"
84 echo "Refusing to molest them"
90 skel="/usr/share/skel/dot.${file}"
91 real="/usr/local/etc/bash-config/${file}"
92 ln -s "${real}" "${skel}" || return $?
100 echo "Skel symlinks already removed"
106 echo "Skel files (${files}) appear to exist, and are not mine"
107 echo "Refusing to molest them"
113 skel="/usr/share/skel/dot.${file}"
114 rm -f "${skel}" || return $?
119 while getopts "cir" opt
123 i) install; exit $? ;;
124 r) remove; exit $? ;;
125 [?]) pebkac "Unrecognized option ${OPTARG}" ;;