SAWADA Keiji
card_capto****@users*****
2006年 4月 1日 (土) 15:02:36 JST
Index: dlkit2/sv/add-client.sub diff -u dlkit2/sv/add-client.sub:1.1.2.2 dlkit2/sv/add-client.sub:1.1.2.3 --- dlkit2/sv/add-client.sub:1.1.2.2 Sun Mar 12 17:10:11 2006 +++ dlkit2/sv/add-client.sub Sat Apr 1 15:02:36 2006 @@ -65,17 +65,20 @@ check_install_type() { echon "Checking installation type... " case "$INSTALL_TYPE" in - type1|disklessify) + disklessify) use_dvddir=false # already installed - use_fin_root=true # rootdir on NFS (post-install) + use_pkgenum=false # already installed + use_fin_root=true # rootdir on NFS (postinstall) ;; - type2|netinstall) - use_dvddir=true # going to install - use_fin_root=false # rootdir on hard drive (post-install) + netinstall) + use_dvddir=true # going to use content + use_pkgenum=false # we use suninstall instead + use_fin_root=false # rootdir on hard drive (postinstall) ;; - type3|diskless|type4|offline) - use_dvddir=true # going to install - use_fin_root=true # rootdir on NFS (post-install) + diskless|offline) + use_dvddir=true # going to use content + use_pkgenum=true # we choose packages by myself + use_fin_root=true # rootdir on NFS (postinstall) ;; *) perror "choose INTALL_TYPE value from: " \ @@ -89,7 +92,7 @@ use_instroot=true # rootdir on NFS at install-time ;; *) - perror "BOOT_TYPE should be newboot" + perror "BOOT_TYPE should be 'newboot'" ;; esac } @@ -168,6 +171,7 @@ # subroutine for adding entries of NFS export file # (=/etc/dfs/dfstab or /etc/exports) + cp /dev/null $cachedir/dfstab if [ ! -f $cachedir/instdir_exported ]; then echo "$fmt" | m4 -DNM="$nm" -DDIR="$SV_DVDDIR" >> $cachedir/dfstab fi @@ -221,7 +225,7 @@ echo "seems working, good" else echo "seems stopped, bad situation" - echo "WARNING: going on anyway, but you probably need to (re)start NFS server" + echo "WARNING: going on anyway, but you probably need to (re)start nfsd" fi echon "Checking NFS export list... " @@ -413,7 +417,6 @@ generate_sysidcfg() { if [ "x$CL_SYSIDCFG" = xyes ]; then echon "Generating sysidcfg file... " - mkdir -p ( echo "name_service=NONE" echo "network_interface=primary {dhcp protocol_ipv6=$CL_SYSIDCFG_IPv6}" echo "security_policy=NONE" @@ -441,7 +444,7 @@ check_install_type prepare_pool_dir check_base_dirs -$use_dvddir && enumerate_packages +$use_pkgenum && enumerate_packages check_nfs_export prepare_tftpboot check_tftpd Index: dlkit2/sv/install-client.sub diff -u dlkit2/sv/install-client.sub:1.1.2.4 dlkit2/sv/install-client.sub:1.1.2.5 --- dlkit2/sv/install-client.sub:1.1.2.4 Wed Mar 29 02:07:17 2006 +++ dlkit2/sv/install-client.sub Sat Apr 1 15:02:36 2006 @@ -166,10 +166,9 @@ cp -p $SV_INSTROOT/sbin/install-setup.dist \ $SV_INSTROOT/sbin/install-setup # XXX TODO - cp -p cl.post-install-netinstall $SV_INSTROOT/sbin/post-setup - echo "Reducing the limitation of physical memory size..." - echon " " - patch -p0 < install-setup-reduce-memory-limitation.patch $SV_INSTROOT/sbin/install-setup + #echo "Reducing the limitation of physical memory size..." + #echon " " + #patch -p0 < install-setup-reduce-memory-limitation.patch $SV_INSTROOT/sbin/install-setup ;; diskless) @@ -288,8 +287,8 @@ cp cl/s98xserver-check $pi_etc/rc2.d/S98xserver-check chmod a+x $pi_etc/rc2.d/S98xserver-check - # reinstaller - cp cl/package-reinstaller.sh.in $trandir/ + # recovery installer + cp cl/package-reinstall.sh.in $trandir/ echo "." } @@ -302,7 +301,6 @@ required_files="cl/diskless-installer cl/disklessify cl/dlpkgadd" cp $required_files $trandir - mkdir -p $trandir/pkgs.done case "$BOOT_TYPE" in newboot) @@ -322,7 +320,7 @@ SunOS) $SV_INSTROOT/boot/solaris/bin/create_ramdisk $SV_INSTROOT ;; - Linux) + *) tempdir=/tmp/tmp.$$ mkdir $tempdir # fails if already there, but it's intentional files="prtconf lockfs" @@ -333,9 +331,6 @@ $SV_INSTROOT/boot/solaris/bin/create_ramdisk $SV_INSTROOT rm -rf $tempdir ;; - *) - echo "Not implemented yet" - ;; esac echo "Installing boot_achive for installation to TFTP directory..." @@ -366,7 +361,7 @@ install_non_std_driver prepare_postinstall_env transfer_installation_script -[ "$INSTALL_TYPE" != "netinstall" -a "$BOOT_TYPE" = "newboot" ] && create_boot_archive +[ "$BOOT_TYPE" = "newboot" ] && create_boot_archive restart_dhcpd echo "" Index: dlkit2/sv/offline-installer.sub diff -u dlkit2/sv/offline-installer.sub:1.1.2.2 dlkit2/sv/offline-installer.sub:1.1.2.3 --- dlkit2/sv/offline-installer.sub:1.1.2.2 Sun Mar 12 17:10:11 2006 +++ dlkit2/sv/offline-installer.sub Sat Apr 1 15:02:36 2006 @@ -1,6 +1,7 @@ #!/bin/sh # -*- shell-script -*- -# offline-installer.sub - install Solaris within server space. +# offline-installer.sub - Solaris installer for "offline" mode. Runs +# at server side (server version of "diskless-installer") # # Copyright (c) 2005-2006 SAWADA Keiji <card_capto****@users*****> # @@ -10,17 +11,18 @@ # modify this program. Whatever you choose, this software comes with # absolutely no warranty. -trandir=cl.trandir -. $trandir/config.in +set -eu +trandir=pool/$CL_CONFIG/trandir CL_ROOT=$SV_FIN_ROOT -PKG_DONE=$trandir/pkgs.done -LOGDIR=$CL_ROOT/var/sadm/install/logs PKGDIR=$SV_PKGDIR +LOG_DIR=$CL_ROOT/var/sadm/install/dlkit_logs +DONE_DIR=$CL_ROOT/var/sadm/install/dlkit_done +FAIL_DIR=$CL_ROOT/var/sadm/install/dlkit_failed + backup_distfile() { file=${1:?} if [ ! -f "$file.dist" ]; then - #echo "$file: made backup" cp -p "$file" "$file.dist" fi } @@ -30,7 +32,7 @@ grep '^NAME=' $PKGDIR/$pkg/pkginfo | sed 's/^NAME=//' } -install_pkgs() { +add_package() { cat > .v.admin <<EOF mail= instance=overwrite @@ -44,23 +46,29 @@ action=nocheck basedir=default EOF - mkdir -p $LOGDIR + pkgadd -d $SV_PKGDIR -a .v.admin -R $SV_FIN_ROOT "$@" +} + +install_pkgs() { + mkdir -p $LOG_DIR $DONE_DIR $FAIL_DIR set +e total=`wc -l < $trandir/pkglist`; total=`expr $total + 0` - i=`ls -1 $PKG_DONE | wc -l`; i=`expr $i + 0` + i=`ls -1 $DONE_DIR | wc -l`; i=`expr $i + 0` set -e + failed='' while read pkg; do - if [ -f $PKG_DONE/$pkg ]; then continue; fi + if [ -f $DONE_DIR/$pkg ]; then continue; fi i=`expr $i + 1` name=`get_package_name "$pkg"` printf "Installing %s, %s [%d/%d]... " $pkg "$name" $i $total - if pkgadd -d $SV_PKGDIR -a .v.admin -R $SV_FIN_ROOT $pkg > $LOGDIR/fake.$pkg 2>&1; then + + if add_package $pkg > $LOGDIR/$pkg 2>&1; then echo "done" - touch $PKG_DONE/$pkg + touch $DONE_DIR/$pkg; rm -f $FAIL_DIR/$pkg else echo "**FAILED**" - failed="$failed $pkg" + touch $FAIL_DIR/$pkg; failed="$failed $pkg" fi done < $trandir/pkglist @@ -71,12 +79,12 @@ install_non_std_driver() { for drv in $NON_STD_DRIVER; do echo "Installing non-standard driver $drv..." - sh $trandir/cm.non-std-driver.$drv offline + (cd $trandir && sh cm.non-std-driver.$drv offline) done } config_etc() { - echo "Installing directory under /etc..." + echo "Creating directory under /etc..." (cd $trandir/etc; find . -type d -print) | while read d; do mkdir -p $CL_ROOT/etc/$d done @@ -88,12 +96,6 @@ cp $trandir/etc/$f $CL_ROOT/etc/$f done - if [ -f $trandir/nsswitch.templ ]; then - backup_distfile $CL_ROOT/etc/nsswitch.conf - cp $CL_ROOT/etc/nsswitch.conf.`cat $trandir/nsswitch.templ` \ - $CL_ROOT/etc/nsswitch.conf - fi - cp /etc/rtc_config $CL_ROOT/etc/rtc_config # copy host config backup_distfile $CL_ROOT/etc/default/init @@ -138,8 +140,18 @@ ) > $CL_ROOT/etc/vfstab } +config_autofs() { + if [ ! -z "$CL_EXPORT_HOME_MODE" ]; then + echo "Setting mode and ownership for $CL_NAME:/export/home..." + mkdir -p $CL_ROOT/export/home + chmod "$CL_EXPORT_HOME_MODE" $CL_ROOT/export/home + chown root $CL_ROOT/export/home + chgrp root $CL_ROOT/export/home + fi +} + config_postinstall_env() { - echo "Configuring post-installation environment... " + echo "Configuring postinstallation environment... " if [ ! -z "$CL_KEYBOARD" ]; then backup_distfile $CL_ROOT/boot/solaris/bootenv.rc @@ -148,20 +160,30 @@ ) > $CL_ROOT/boot/solaris/bootenv.rc fi + # TODO: CL_FIN_BOOTFLAG still valid for newboot? if [ ! -z "$CL_FIN_BOOTFLAG" ]; then echo "set rb_args '$CL_FIN_BOOTFLAG'" \ > $CL_ROOT/boot/solaris/bootargs.rc fi + + $CL_ROOT/boot/solaris/bin/create_ramdisk $CL_ROOT } -config_autofs() { - if [ ! -z "$CL_EXPORT_HOME_MODE" ]; then - echo "Setting mode and ownership for $CL_NAME:/export/home..." - mkdir -p $CL_ROOT/export/home - chmod "$CL_EXPORT_HOME_MODE" $CL_ROOT/export/home - chown root $CL_ROOT/export/home - chgrp root $CL_ROOT/export/home - fi +config_package_reinstall_sh() { + ( echo "#!/bin/sh" + echo "mount_cdrom() {" + if [ -z "$CL_MOUNT_OPTION" ]; then + echo " mount $SV_IPADDR:$SV_PKGDIR /cdrom" + else + echo " mount -o $CL_MOUNT_OPTION $SV_IPADDR:$SV_PKGDIR /cdrom" + fi + echo "}"; echo; echo + cat $trandir/package-reinstall.sh.in + ) > $CL_ROOT/package-reinstall.sh + chmod +x $CL_ROOT/package-reinstall.sh + + # TODO: XXX + mkdir -p $CL_ROOT/etc/skel/.gnome2/panel2.d/default/launchers } #---------------------------------------------------------------------- @@ -183,5 +205,6 @@ config_vfstab config_autofs config_postinstall_env + config_package_reinstall_sh ;; esac Index: dlkit2/sv/restart-dhcpd.sh diff -u dlkit2/sv/restart-dhcpd.sh:1.1.2.2 dlkit2/sv/restart-dhcpd.sh:1.1.2.3 --- dlkit2/sv/restart-dhcpd.sh:1.1.2.2 Wed Mar 29 01:45:04 2006 +++ dlkit2/sv/restart-dhcpd.sh Sat Apr 1 15:02:36 2006 @@ -11,7 +11,11 @@ conf=pool/dhcpd.conf echo "Gathering DHCP configuration file..." -cat pool/dhcpd00.conf pool/*/dhcpd-client.conf pool/dhcpd99.conf > $conf +(for f in pool/dhcpd00.conf pool/*/dhcpd-client.conf pool/dhcpd99.conf; do + if [ -f "$f" ]; then + cat "$f" + fi +done) > $conf case "$pref" in isc_csw)