head 1.1; access; symbols netbsd-10-0-RELEASE:1.1 netbsd-10-0-RC6:1.1 netbsd-10-0-RC5:1.1 netbsd-10-0-RC4:1.1 netbsd-10-0-RC3:1.1 netbsd-10-0-RC2:1.1 netbsd-10-0-RC1:1.1 netbsd-10:1.1.0.14 netbsd-10-base:1.1 netbsd-9-3-RELEASE:1.1 cjep_sun2x-base1:1.1 cjep_sun2x:1.1.0.12 cjep_sun2x-base:1.1 cjep_staticlib_x-base1:1.1 netbsd-9-2-RELEASE:1.1 cjep_staticlib_x:1.1.0.10 cjep_staticlib_x-base:1.1 netbsd-9-1-RELEASE:1.1 phil-wifi-20200421:1.1 phil-wifi-20200411:1.1 is-mlppp:1.1.0.8 is-mlppp-base:1.1 phil-wifi-20200406:1.1 netbsd-9-0-RELEASE:1.1 netbsd-9-0-RC2:1.1 netbsd-9-0-RC1:1.1 phil-wifi-20191119:1.1 netbsd-9:1.1.0.6 netbsd-9-base:1.1 phil-wifi-20190609:1.1 pgoyette-compat-merge-20190127:1.1 pgoyette-compat-20190127:1.1 pgoyette-compat-20190118:1.1 pgoyette-compat-1226:1.1 pgoyette-compat-1126:1.1 pgoyette-compat-1020:1.1 pgoyette-compat-0930:1.1 pgoyette-compat-0906:1.1 pgoyette-compat-0728:1.1 phil-wifi:1.1.0.4 phil-wifi-base:1.1 pgoyette-compat-0625:1.1 pgoyette-compat-0521:1.1 pgoyette-compat-0502:1.1 pgoyette-compat-0422:1.1 pgoyette-compat-0415:1.1 pgoyette-compat-0407:1.1 pgoyette-compat-0330:1.1 pgoyette-compat-0322:1.1 pgoyette-compat-0315:1.1 pgoyette-compat:1.1.0.2 pgoyette-compat-base:1.1; locks; strict; comment @# @; 1.1 date 2018.01.09.03.31.14; author christos; state Exp; branches; next ; commitid nhHsbnoK9vzLm9mA; desc @@ 1.1 log @Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet @ text @#!/bin/sh # # $NetBSD$ # # Modify this to suit your needs. The "$1" is the map name, eg. "auto_master". # To debug, simply run this script with map name as the only parameter. It's # supposed to output map contents ("key location" pairs) to standard output. SEARCHBASE="ou=$1,dc=example,dc=com" ENTRY_ATTRIBUTE="cn" VALUE_ATTRIBUTE="automountInformation" ldapsearch -LLL -x -o ldif-wrap=no -b "$SEARCHBASE" "$ENTRY_ATTRIBUTE" "$VALUE_ATTRIBUTE" | awk ' $1 == "'$ENTRY_ATTRIBUTE':" { key = $2 } $1 == "'$VALUE_ATTRIBUTE':" { for (i = 2; i <= NF; i++) { value[i] = $(i) } nvalues = NF b64 = 0 } # Double colon after attribute name means the value is in Base64. $1 == "'$VALUE_ATTRIBUTE'::" { for (i = 2; i <= NF; i++) { value[i] = $(i) } nvalues = NF b64 = 1 } # Empty line - end of record. NF == 0 && key != "" && nvalues > 0 { printf "%s%s", key, OFS for (i = 2; i < nvalues; i++) { printf "%s%s", value[i], OFS } if (b64 == 1) { printf "%s", value[nvalues] | "b64decode -rp" close("b64decode -rp") printf "%s", ORS } else { printf "%s%s", value[nvalues], ORS } } NF == 0 { key = "" nvalues = 0 delete value } ' @