Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2001 15:58:28 -0800 (PST)
From:      Will Froning <wfroning@angui.sh>
To:        <freebsd-questions@freebsd.org>
Subject:   SUMMARY: amd_map_program in rc.conf
Message-ID:  <20011108154858.F25048-100000@angui.sh>
In-Reply-To: <20011108091534.O92860-100000@angui.sh>

next in thread | previous in thread | raw e-mail | index | archive | help
I didn't get any responses, but I hacked my way through.  Here's how I did
it.

So solve the problem of getting unique keys with the config file from NIS,
I added line numbers to the map.  That gave each linne a unique key and
correct corrisponding value.

But when the master map was servered, it was not in order.  This I solved
with sort -n.

These were the final options in /etc/rc.conf:
amd_enable="YES"
amd_flags="-l syslog -F /etc/amd.conf"
amd_map_program="/etc/make_amd_maps"

/etc/make_amd_maps:
#!/bin/sh

ypcat -k amd.master | sort -n | sed 's/^[0-9 ]*//' > /etc/amd.conf

This does have a limitation where it will only be refreshed during reboot,
but I think that's not too bad.

If you have questions, please ask.

Will


> OS: FreeBSD 4.3
>
> Ok so the hack to get arund this non-unique key is to add line numbers.
> But NIS doesn't care about map order when publishing maps.  So the whole
> work around is:
>
> ypcat -k amd.master | sort -n | awk '{print $2 $3 $4}'
>
> Now I need to somehow get this assigned to amd_map_program.  Here are the
> relevant entries from /etc/rc.conf.
>
> amd_enable="YES"
> amd_flags="-l syslog -F ${amd_map_program}"
> amd_map_program="`ypcat -k amd.master | sort -n | awk '{print $2 $3 $4}'`"
>
> But this doesn't work.  Any tips?  Am I not setting amd_map_program
> correctly?  Any help is appreciated.
>
> Thanks,
> Will
>
> > OS: FreeBSD 4.3
> >
> > I noticed the option in rc.conf to have amd pull it's config file from
> > NIS.  I'd like to implement that options, but I've run into a small
> > problem.
> >
> > When I add the map to NIS it doesn't convert the file correctly.  It drops
> > about 1/3 of the lines in the file.  I've attached the file and the
> > output of ypcat -k amd.master.
> >
> > I gues the real question would be what sed/awk options do I need to pass
> > to yp_mkdb and how do I make yp accept that each of the yp "keys" are
> > unique.
> >
> > Thanks,
> > Will
> >
> > Please reply to me as well.  I'm not on the list.
> >
> > ****OUTPUT****
> > cd1# cat amd.conf
> > # GLOBAL OPTIONS SECTION
> > [ global ]
> > normalize_hostnames =	no
> > print_pid =		no
> > restart_mounts =	yes
> > auto_dir =		/.amd_mnt
> > log_options =		all
> > plock =			no
> > selectors_on_default =	yes
> > map_type =		file
> > search_path =		/etc:/etc/amdmaps
> > browsable_dirs =	no
> >
> > # DEFINE AMD MOUNT POINTS
> > [ /net ]
> > map_name =		amd.map
> > map_type =		file
> >
> > [ /host ]
> > map_name =		amd.map
> > map_type =		file
> >
> > [ /home ]
> > map_name =		amd.home
> > map_type =		nis
> >
> > [ /devel ]
> > map_name =		amd.home
> > map_type =		nis
> >
> > [ /scotty ]
> > map_name =		amd.scotty
> > map_type =		nis
> >
> > [ /testing_grounds ]
> > map_name =		amd.lab
> > map_type =		nis
> > map_options =		type:=direct
> >
> > [ /svnlogs ]
> > map_name =		amd.lab
> > map_type =		nis
> > map_options =		type:=direct
> >
> > [ /svnlogs2 ]
> > map_name =		amd.lab
> > map_type =		nis
> > map_options =		type:=direct
> >
> > cd1# yp_mkdb amd.conf amd.master
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '#' - skipping
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_name' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_name' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_name' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_name' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_name' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_name' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: duplicate key 'map_options' - skipping
> > yp_mkdb: bad input -- no white space:
> > yp_mkdb: duplicate key '[' - skipping
> > yp_mkdb: duplicate key 'map_name' - skipping
> > yp_mkdb: duplicate key 'map_type' - skipping
> > yp_mkdb: duplicate key 'map_options' - skipping
> >
> > cd1# yp_mkdb -u amd.master
> > print_pid =		no
> > plock =			no
> > map_options =		type:=direct
> > normalize_hostnames =	no
> > restart_mounts =	yes
> > search_path =		/etc:/etc/amdmaps
> > browsable_dirs =	no
> > # GLOBAL OPTIONS SECTION
> > [ global ]
> > YP_MASTER_NAME cd1.corp124.com
> > YP_LAST_MODIFIED 1005179813
> > selectors_on_default =	yes
> > log_options =		all
> > map_name =		amd.map
> > auto_dir =		/.amd_mnt
> > map_type =		file
> >
> >
> >
>
>

-- 
Will Froning
Unix Sys. Admin.
wfroning@angui.sh


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011108154858.F25048-100000>