Date: Sun, 11 Jun 2000 17:36:03 -0700 From: "Crist J. Clark" <cjc@earthlink.net> To: freebsd-mobile@freebsd.org Subject: Multi-Location Configuration Message-ID: <20000611173603.A204@dialin-client.earthlink.net>
next in thread | raw e-mail | index | archive | help
Something I have been meaning to ask about but never seem to get to. So, on a lazy Sunday afternoon by the pool I type... There have been threads on this list about how to best setup a notebook PC to operate differently depending on how it is being used. Since notebooks are, by design, meant to be moved around, they often will be hooked into different networks, have different hardware connected, and have other changes made. Tools like PCCard support by their very nature support this type of thing, but many other systems on FreeBSD assume things do not change from boot up to boot up. (I am not going to touch the issue of moving a live system around.) My particular solution has been to make a tree in /etc called /etc/location. In this directory are any number of subdirs which each correspond to a different setup, plus there is one symlink pointing to the configuration presently in use. For example, % ls -l /etc/location total 5 lrwxr-xr-x 1 root wheel 10 Jun 11 13:20 current -> standalone drwxr-xr-x 2 root wheel 512 Jun 10 13:38 earthlink drwxr-xr-x 2 root wheel 512 Jun 11 13:21 home drwxr-xr-x 2 root wheel 512 Jun 5 19:29 work-dialin drwxr-xr-x 2 root wheel 512 Mar 26 21:02 work-office drwxr-xr-x 2 root wheel 512 Jun 5 19:28 standalone Each directory contains files that are customized for each location, % ls -l /etc/location/home total 99 -rw-r--r-- 1 root wheel 308 Apr 4 19:05 fstab -rw-r--r-- 1 root wheel 191 Jun 3 16:38 hosts -rw------- 1 root wheel 985 Feb 7 15:51 master.passwd -rw-r--r-- 1 root wheel 851 Feb 7 15:51 passwd -rw-r--r-- 1 root wheel 40960 Feb 7 15:51 pwd.db -rw-r--r-- 1 root wheel 531 Jun 3 20:35 rc.conf -rw-r--r-- 1 root wheel 91 Feb 16 18:53 resolv.conf -rw-r--r-- 1 root wheel 12587 Feb 13 13:10 sendmail.cf -rw------- 1 root wheel 40960 Feb 7 15:51 spwd.db And the corresponding entries in /etc for each of the files is a symlink to /etc/location/current. When booting up a system in a new environment, I stop in single-user mode and change the symlink, # mount / # cd /etc/location # rm current && ln -s home current # ^D This works well enough, but what would be really neat would be to have the system stop, offer the configurations available, report the current choice (the present default), wait a few seconds for user input, and then continue with the boot with the default or user's choice. I wrote scripts that do most of the work for this, but there are problems, - This needs to be done _very_ early in the boot process (rc.conf is one of the first files read by /etc/rc as well as /etc/fstab). There is a chicken and egg problem in that I want to use a custom /etc/fstab, but in order to change /etc/location, we must have already mounted the filesystems (the root fs anyway) read-write. - The passwd(1) (via pwd_mkdb(8) I believe) command will clobber the symlinks in /etc and write the new files directly in /etc. For chpass(1)-type operations, root can edit /etc/location/<loc>/master.passwd and then run pwd_mkdb with the -d option, but requiring a root login is a hassle and still does not fix the password making/changing issue. - I need a sendmail(8) god to figure out how to get messages in the queue to be sent properly no matter which networked configuration we start in. (Of course we want them to be queued up correctly in standalone too.) I think those are the main issues. If anyone has any ideas, whether or not you feel they are worthy traffic on the list, let me know. Oh, and as one other aside about startup, getting mice to be "auto-detected." Sometimes I plug in a three-button serial mouse (it's not that the builtin trackball on my DELL is a pain, I actually find it quite usable, but it only is two-button). Anyone have a method to auto-detect a serial mouse? If it is there, I'll use it and change my XF86Config apropriately. If not, I use the default PS2 trackball and turn on three-button emulation. Once again, it is a hassle to get in there as root and make the manual changes, especially if I realize I already started X with the three-button emulation improperly set. Thanks for any help. -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000611173603.A204>