SAWADA Keiji
card_capto****@users*****
2006年 3月 29日 (水) 02:07:51 JST
Index: dlkit2/cl/diskless-installer diff -u dlkit2/cl/diskless-installer:1.1.2.1 dlkit2/cl/diskless-installer:1.1.2.2 --- dlkit2/cl/diskless-installer:1.1.2.1 Sun Mar 12 14:18:56 2006 +++ dlkit2/cl/diskless-installer Wed Mar 29 02:07:51 2006 @@ -1,17 +1,31 @@ #!/bin/sh # -*- shell-script -*- +# diskless-installer - Solaris installer for "diskless" mode. Runs at +# client side (client version of "offline-installer") +# +# Copyright (c) 2005-2006 SAWADA Keiji <card_capto****@users*****> +# Copyright (c) 2006 teelime <teeli****@users*****> +# +# This program is free software and has two license options; GNU +# General Public License, or Common Development and Distribution +# License. You can and must select one when you redistribute and/or +# modify this program. Whatever you choose, this software comes with +# absolutely no warranty. + +set -eux trandir=/dlkit . $trandir/config.in CL_ROOT=/a -PKG_DONE=$trandir/pkgs.done -LOGDIR=$CL_ROOT/var/sadm/install/logs + PKGDIR=/cdrom/Solaris_*/Product/ +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 } @@ -47,23 +61,24 @@ } install_pkgs() { - mkdir -p $LOGDIR + 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 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 $trandir/dlpkgadd $pkg > $LOGDIR/dlkit.$pkg 2>&1; then + + if $trandir/dlpkgadd $pkg > $LOG_DIR/$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 fi done < $trandir/pkglist @@ -181,56 +196,19 @@ } config_package_reinstall_sh() { - grep "pkgadd: ERROR" $LOGDIR/dlkit.* | cut -d"." -f2 | cut -d":" -f1 | sort -u > $CL_ROOT/package.lst - - cat > $CL_ROOT/package-reinstall.sh <<EOC -#!/bin/sh - -LANG=C -export LANG - -ADMIN=/tmp/admin.\$\$ -packages=\`cat package.lst\` - -mkdir /cdrom 2>/dev/null -EOC - - if [ -z "$CL_MOUNT_OPTION" ]; then - cat >> $CL_ROOT/package-reinstall.sh <<EOC -mount $SV_IPADDR:$SV_PKGDIR /cdrom -EOC - else - cat >> $CL_ROOT/package-reinstall.sh <<EOC -mount -o $CL_MOUNT_OPTION $SV_IPADDR:$SV_PKGDIR /cdrom -EOC - fi - - cat >> $CL_ROOT/package-reinstall.sh <<EOC -cd /cdrom - -cat > \$ADMIN <<EOF -mail= -instance=overwrite -partial=nocheck -runlevel=nocheck -idepend=nocheck -rdepend=nocheck -space=nocheck -setuid=nocheck -conflict=nocheck -action=nocheck -basedir=default -EOF - -for package in \$packages; do - pkgadd -d . -a \$ADMIN \$package -done - -cd / -umount /cdrom -rm -f \$ADMIN -EOC + ( 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 } @@ -240,7 +218,6 @@ #---------------------------------------------------------------------- echo "Preparing installation scripts..." -set -e case "$1" in -nopkg)