install url --url ftp://172.31.253.1/pub/rhel-4-desktop-i386 lang en_US.UTF-8 langsupport --default=en_US.UTF-8 en_US.UTF-8 keyboard us #skipx xconfig text network --device eth0 --bootproto static --ip=172.31.254.139 --netmask=255.255.255.0 --gateway=172.31.254.2 --nameserver 172.31.254.129 --hostname=guinea-pig.dahyabhai.net rootpw canal firewall --disabled selinux --permissive authconfig --enableshadow --enablemd5 timezone America/New_York bootloader --location=mbr --append="rhgb" zerombr yes clearpart --all autopart # REMOVE THIS firstboot --disable %packages @ admin-tools @ base-x @ editors @ gnome-desktop @ graphical-internet @ graphics @ office @ printing @ sound-and-video @ system-tools @ text-internet kernel samba-common e2fsprogs grub %post # The Windows domain name. We'll probe for the rest of the settings shortly. domain=dahyabhai.net serverfor() { service=$1 type=${2:-srv} host -v ${type:+-t $type} "$service.$domain" $dns | grep ^"$service.$domain" | \ awk '{print $NF}' | head -n1 | sed -e 's,\.$,,' } upcase() { echo "$@" | tr '[[:lower:]]' '[[:upper:]]' } initial() { echo "$@" | cut -f1 -d. } # Find the address of the Kerberos KDC. krb5kdc=$(serverfor _kerberos._udp) # The krb5 realm name is the same as the domain name. krb5realm=$(upcase $domain) # Derive the workgroup name. smbworkgroup=$(upcase $(initial $domain)) # Assume that _msdcs points to Microsoft domain controllers. smbservers=$(serverfor _msdcs ns) # We're in ADS mode. smbsecurity=ads # Yeah, we knew this one. smbrealm=$(upcase $domain) # Set up the configuration files. /usr/sbin/authconfig --nostart --kickstart \ --enablekrb5 \ ${krb5kdc:+--krb5kdc=$krb5kdc} \ ${krb5realm:+--krb5realm=$krb5realm} \ --enablekrb5kdcdns \ --enablekrb5realmdns \ --enablewinbind \ ${smbworkgroup:+--smbworkgroup=$smbworkgroup} \ ${smbservers:+--smbservers=$smbservers} \ ${smbrealm:+--smbrealm=$smbrealm} \ --winbindtemplateshell=/bin/bash \ --enablewinbindusedefaultdomain # Set the hostname. The installation doesn't actually set the current hostname, # and we need it to have the right value for "net join" to work properly. hostname guinea-pig.dahyabhai.net # Join the domain. /usr/bin/net join -U admin%random # Set the system up to automatically create home directories for domain users. # The rest of the file is boilerplate. cat > /root/mkhomedir << "EOF" #!/bin/bash -e # # Create home directories for specified users who have UIDs above a certain # value. The default value is 500, as set in "/etc/login.defs". Either # pass a list of user names in on the command line, or run with "--all" to # create home directories for all known users. # # if test $# -lt 1 ; then echo Usage: `basename $0` '[ -m 500 ] [ --minimum-uid=500 ] [ user ... | "-a" | "--all" ]' exit 1 fi minuid=`grep '^UID_MIN[ ]' /etc/login.defs | awk '{print $NF}'` minuid=${minuid:-500} users= all=false testmode=false while test -n "$1" ; do case "$1" in -a|--all) all=true;; -m[0-9]*) minuid=`echo $1 | cut -c3-`;; --minimum-uid=[0-9]*) minuid=`echo $1 | cut -f2 -d=`;; -m|--minimum-uid) shift; minuid=$1;; -t|--test) testmode=true;; *) users="$users $1";; esac shift done mkonehomedir() { if ! test -d "$homedir" ; then echo "$user" if $testmode ; then continue fi if mkdir -pm700 "$homedir" ; then if pushd /etc/skel > /dev/null ; then find . | sort -r | cpio --quiet -pmd "$homedir" popd > /dev/null fi chown -R "$uid":"$gid" "$homedir" chmod 700 "$homedir" find "$homedir" -print0 | xargs -0 -r -n1 restorecon groupwrite=false if test "$uid" -eq "$gid" ; then if test `id -un "$user"` = `id -gn "$user"` ; then groupwrite=true fi fi if $groupwrite ; then chmod 775 "$homedir" else chmod 755 "$homedir" fi # Hey, why not? if test -d /etc/mkhomedir.d ; then for script in /etc/mkhomedir.d/* ; do if test -x $script ; then $script "$user" "$homedir" fi done fi fi fi } mkhomedir() { oldIFS="$IFS" IFS=: while read user passwd uid gid gecos homedir shell ; do if test "$uid" -ge "$minuid" ; then if ! echo "$user" | egrep -q '(_|\$$)' ; then mkonehomedir fi fi done IFS="$oldIFS" } if $all ; then getent passwd | grep -v '^+' | sed -e 's,\\,\\\\,g' | mkhomedir else getent passwd $users | sed -e 's,\\,\\\\,g' | mkhomedir fi EOF cat > /etc/cron.daily/call-mkhomedir << "EOF" #!/bin/bash /root/mkhomedir -a EOF chmod +x /root/mkhomedir /etc/cron.daily/call-mkhomedir ln -s /etc/cron.daily/call-mkhomedir /etc/rc.d/rc3.d/S99mkhomedir ln -s /etc/cron.daily/call-mkhomedir /etc/rc.d/rc5.d/S99mkhomedir