Permalink
Browse files

etcinstall: make merging more flexible

  • Loading branch information...
1 parent fc10eee commit c490555efa187338e6a8d392bc0bd6a4ae1e9657 @majutsushi committed Mar 26, 2013
Showing with 24 additions and 6 deletions.
  1. +22 −6 bin/etcinstall.sh
  2. +2 −0 xorg/Xmodmap.d/{urd → 50_urd}
View
@@ -2,6 +2,17 @@
set -e
+
+OSNAME=$(uname -s)
+HOST=${HOST:-$(hostname)}
+HOST=${HOST/.*}
+DOMAIN=${DOMAIN:-$(hostname -d 2>&-)}
+if [[ "$DOMAIN" == "" || "$DOMAIN" == "localdomain" || "$DOMAIN" == "(none)" ]]; then
+ DOMAIN=$(grep "^domain " /etc/resolv.conf | cut -d' ' -f2)
+fi
+export OSNAME HOST DOMAIN
+
+
info() {
# echo -e "\033[32m$1\033[0m"
echo -e "$1"
@@ -35,12 +46,17 @@ merge() {
echo "$comment *** GENERATED FILE - DO NOT EDIT ***" > $target
echo "$comment [$(readlink -f $conffile)]" >> $target
cat $conffile >> $target
- for part in $conffile.d/*; do
- if [[ "$(hostname)" == "$(basename $part)" ]]; then
- echo -e "\n$comment [$(readlink -f $part)]" >> $target
- cat $part >> $target
- fi
- done
+
+ if [[ -d $conffile.d ]]; then
+ for part in $conffile.d/??_*; do
+ csplit -s $part '/^# --- CUT HERE ---$/+1'
+ if bash xx00; then
+ echo -e "\n$comment [$(readlink -f $part)]" >> $target
+ cat xx01 >> $target
+ fi
+ rm xx0[01]
+ done
+ fi
local localfile=$HOME/.local/etc/$(basename "$conffile")
if [[ -f $localfile ]]; then
@@ -1,3 +1,5 @@
+[[ $HOST == urd ]]
+# --- CUT HERE ---
keycode 49 = section plusminus
keycode 94 = grave asciitilde
! keycode 108 = Insert NoSymbol Pointer_Button3

0 comments on commit c490555

Please sign in to comment.