home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh -f
- #
- # Upgrader post-processing script for 2.X systems.
-
- set path = (/bin /usr/bin /etc /usr/etc /usr/ucb)
-
- if ($#argv != 2) then
- echo "Usage: PostProcess targroot sourceroot"
- exit 1
- endif
-
- set target = $argv[1]
- set source = $argv[2]
-
- cd ${target}/etc/netinfo
- set databases = `ls ${target}/etc/netinfo`
-
- foreach database ($databases)
-
- echo "Updating NetInfo database ${database}:"
- set tag = `basename ${database} .nidb`
- if ($tag == $database) then
- echo " ...but it's not a database. Skipping."
- continue
- endif
- if (${target}x != "/x") then
- mv ${tag}.nidb XXXX.nidb
- (/usr/etc/netinfod XXXX &) > /dev/null
- set usetag = XXXX
- else
- set usetag = $tag
- endif
-
- # If root directory isn't writable, we probably aren't the master.
-
- niutil -createprop -t localhost/${usetag} / _thing _thing >& /dev/null
- if ($status != 0) then
- echo " ...but this isn't the master server for it. Skipping."
- goto killdomain
- else
- niutil -destroyprop -t localhost/${usetag} / _thing
- endif
-
- echo -n " Updating user accounts..."
- set users = `niutil -t -list localhost/${usetag} /users|awk '{print $2}'`
- foreach user ($users)
- niutil -t -list localhost/${usetag} /users/${user}/info >& /dev/null
- if ($status != 0) then
- niutil -t -create localhost/${usetag} /users/${user}/info
- niutil -t -createprop localhost/${usetag} /users/${user}/info _writers ${user}
- endif
- end
- echo "$#users accounts"
-
- echo " Creating /locations/renderers..."
- niutil -t -list localhost/${usetag} /locations/renderers >& /dev/null
- if ($status != 0) then
- niutil -t -create localhost/${usetag} /locations/renderers >& /dev/null
- niutil -t -createprop localhost/${usetag} /locations/renderers _writeUa*' >& /dev/null
- niutil -t -create localhost/${usetag} /locations/renderers/localhost >& /dev/null
- niutil -t -createprop localhost/${usetag} /locations/renderers/localhost _writers '*' >& /dev/null
- niutil -t -createprop localhost/${usetag} /locations/renderers/localhost note "Local >& /dev/null Renderer"
- endif
-
- echo " Updating /rpcs..."
- niutil -t -list localhost/${usetag} /rpcs/renderd >& /dev/null
- if ($status != 0) then
- niutil -t -create localhost/${usetag} /rpcs/renderd >& /dev/null
- niutil -t -createprop localhost/${usetag} /rpcs/renderd number 200100002 >& /dev/null
- niutil -t -destroyprop localhost/${usetag} /rpcs/rexd number >& /dev/null
- niutil -t -destroy localhost/${usetag} /rpcs/rexd >& /dev/null
- endif
-
- echo " Removing decode alias..."
- niutil -t -destroyprop localhost/${usetag} /aliases/decode members >& /dev/null
- niutil -t -destroy localhost/${usetag} /aliases/decode >& /dev/null
-
- if ($tag == "local") then
- echo " Creating /localconfig..."
- niutil -t -list localhost/${usetag} /localconfig >& /dev/null
- if ($status != 0) then
- niutil -t -create localhost/${usetag} /localconfig
- endif
- # Make sure old language and keyboard dirs aren't around.
- niutil -t -destroy localhost/${usetag} /localconfig/language >& /dev/null
- niutil -t -destroy localhost/${usetag} /localconfig/keyboard >& /dev/null
- niutil -t -list localhost/${usetag} /screens >& /dev/null
- if ($status == 0) then
- set screens = `niutil -t -list localhost/${usetag} /screens | awk '{print $2}'`
- foreach screen ($screens)
- foreach prop (slot unit bounds active)
- set value = `niutil -read . /screens/$screen | grep $prop | awk -F: '{print $2}'`
- niutil -t -destroyprop localhost/${usetag} /screens/$screen $prop
- end
- niutil -t -destroyprop localhost/${usetag} /screens/$screen _writers >& /dev/null
- niutil -t -destroy localhost/${usetag} /screens/$screen
- end
- niutil -t -destroy localhost/${usetag} /screens
- endif
- if (-f ${target}/private/etc/exports && ! -f ${target}/private/etc/exports.old) then
- echo " Converting /etc/exports to NetInfo..."
- ${source}/Upgrade_3.0.app/loadexports -t exports localhost/${usetag} < ${target}/private/etc/exports
- mv ${target}/private/etc/exports ${target}/private/etc/exports.old
- cat > ${target}/private/etc/exporUb< XXX
- # THIS FILE IS OBSOLETE. NFS exports are now stored in NetInfo.
- #
- # To export disks, use the NFSManager application located in /NextAdmin.
- # You can also niload an old-format exports file, or add the entries
- # to the /exports directory of your local NetInfo domain by hand.
- #
- # Your old /etc/exports has been saved in /etc/exports.old.
- XXX
- endif
- endif
-
- killdomain:
-
- if (${target}x != "/x") then
- set pid = `ps ax | grep "netinfod XXXX" | grep -v grep | awk '{print $1}'`
- kill -TERM $pid
- mv XXXX.nidb ${tag}.nidb
- endif
-
- end
-
- echo -n "NetInfo changes complete. "
-
- foreach language (French German Italian Swedish Spanish English)
- /bin/rm -rf ${target}/NextLibrary/Receipts/${language}.pkg
- end
-
- if (-d ${source}/Upgrade_3.0.app/Default.upgrade/Languages) then
- echo "Checking sizes for languages..."
- set freekbytes = `df ${target} | tail -1 | awk '{print $4}'`
- set langkbytes = `du -s ${source}/Upgrade_3.0.app/Default.upgrade/Languages | awk '{print $1}'`
- echo "Languages require ${langkbytes}K, and ${freekbytes}K are available."
- if ($freekbytes > ($langkbytes + 1000)) then
- echo "Installing languages..."
- mkdirs ${target}/NextLibrary/Receipts
- cd ${source}/Upgrade_3.0.app/Default.upgrade/Languages
- tar cf - *.pkg | (cd ${target}/NextLibrary/Receipts; tar xf -)
- else
- echo "There isn't enough space to install all the languages."
- echo "Checking size for English help..."
- set langkbytes = `du -s ${source}/Upgrade_3.0.app/Default.upgrade/Languages/English.pkg | awk '{print $1}'`
- echo "English help requires ${langkbytes}K, and ${freekbytes}K are available."
- if ($freekbytes > ($langkbytes + 1000)) then
- echo "Installing English help..."
- mkdirs ${target}/NextLibrary/Receipts
- cd ${source}/Upgrade_3.0.app/Default.upgrade/Languages
- tar cf - English.pkg | (cd ${target}/NextLibrary/Receipts; tar xf -)
- else
- echo "There isn't enough space to install English help."
- endif
- endif
- else
- echo ""
- endif
-
- echo -n "Postprocessing complete at "
- date
- echo "Upgrade complete."
-
- exit 0
-