Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dteske@ipm0.dev.vicor.com tools $ ./host_rebuild -nvr 8.1-RELEASE
- Rebuild / with repository 8.1-RELEASE
- TEST-ONLY! No actions will be performed.
- #################### Source 8.1-RELEASE specific config file
- . "./etc/8.1-RELEASE.conf"
- #################### Run 8.1-RELEASE specific pre_install
- pre_install
- # Preflight sanity check (check release)
- # Migration from 4.11-STABLE to 8.1-RELEASE allowed
- # Prevent disappearance of tar(1)
- rm -Rfv /var/db/pkg/tar-1.5
- # Move `/usr/local/etc/rc.d' to `/usr/local/etc/rc.d.xbak-2013-07-08.10:57:34-4.11-STABLE'
- mv -v /usr/local/etc/rc.d /usr/local/etc/rc.d.xbak-2013-07-08.10:57:34-4.11-STABLE
- mkdir -pv /usr/local/etc/rc.d
- chmod -v 0755 /usr/local/etc/rc.d
- chown -v root:wheel /usr/local/etc/rc.d
- #################### Find/Remove core-dumps to free-up disk space
- find -x "/" -maxdepth 2 -name '*.core' -type f | xargs rm -fv
- #################### Back up /etc to /etc.xbak-2013-07-08.10:57:34-4.11-STABLE
- cp -RPpfv /etc /etc.xbak-2013-07-08.10:57:34-4.11-STABLE
- #################### Back up /usr/local/etc to /usr/local/etc.xbak-2013-07-08.10:57:34-4.11-STABLE
- cp -RPpfv /usr/local/etc /usr/local/etc.xbak-2013-07-08.10:57:34-4.11-STABLE
- #################### Uninstall 342 packages...
- pkg_delete -fav
- #################### Prepare /oldbase directory
- cp -pfv ./crunch/rebuild_crunch4 /oldbase/rebuild_crunch4
- ln -sfv rebuild_crunch4 /oldbase/cat
- ln -sfv rebuild_crunch4 /oldbase/chmod
- ln -sfv rebuild_crunch4 /oldbase/cp
- ln -sfv rebuild_crunch4 /oldbase/date
- ln -sfv rebuild_crunch4 /oldbase/ln
- ln -sfv rebuild_crunch4 /oldbase/ls
- ln -sfv rebuild_crunch4 /oldbase/mkdir
- ln -sfv rebuild_crunch4 /oldbase/mv
- ln -sfv rebuild_crunch4 /oldbase/rm
- ln -sfv rebuild_crunch4 /oldbase/sh
- ln -sfv rebuild_crunch4 /oldbase/sleep
- ln -sfv rebuild_crunch4 /oldbase/awk
- ln -sfv rebuild_crunch4 /oldbase/chflags
- ln -sfv rebuild_crunch4 /oldbase/chpass
- ln -sfv rebuild_crunch4 /oldbase/chsh
- ln -sfv rebuild_crunch4 /oldbase/env
- ln -sfv rebuild_crunch4 /oldbase/find
- ln -sfv rebuild_crunch4 /oldbase/sed
- ln -sfv rebuild_crunch4 /oldbase/stat
- ln -sfv rebuild_crunch4 /oldbase/xargs
- ln -sfv rebuild_crunch4 /oldbase/dialog
- ln -sfv rebuild_crunch4 /oldbase/gzip
- ln -sfv rebuild_crunch4 /oldbase/tar
- ln -sfv rebuild_crunch4 /oldbase/reboot
- ln -sfv rebuild_crunch4 /oldbase/chown
- ln -sfv rebuild_crunch4 /oldbase/chroot
- ln -sfv rebuild_crunch4 /oldbase/mtree
- ln -sfv rebuild_crunch4 /oldbase/pwd_mkdb
- #################### Sandbox myself into /oldbase
- # For csh(1) or tcsh(1):
- # setenv SHELL "/oldbase/sh"
- # setenv PATH "/oldbase"
- # rehash
- # For sh(1) or bash(1):
- # export SHELL="/oldbase/sh"
- # export PATH="/oldbase"
- # hash -r
- #################### Perform final sanity checks
- # Make sure /oldbase exists
- # Make sure /oldbase is a directory
- # Make sure $SHELL exists in /oldbase
- # Make sure awk exists within /oldbase
- # Make sure cat exists within /oldbase
- # Make sure chflags exists within /oldbase
- # Make sure chmod exists within /oldbase
- # Make sure chown exists within /oldbase
- # Make sure chpass exists within /oldbase
- # Make sure chroot exists within /oldbase
- # Make sure chsh exists within /oldbase
- # Make sure cp exists within /oldbase
- # Make sure date exists within /oldbase
- # Make sure dialog exists within /oldbase
- # Make sure env exists within /oldbase
- # Make sure find exists within /oldbase
- # Make sure gzip exists within /oldbase
- # Make sure ln exists within /oldbase
- # Make sure ls exists within /oldbase
- # Make sure mkdir exists within /oldbase
- # Make sure mtree exists within /oldbase
- # Make sure mv exists within /oldbase
- # Make sure pwd_mkdb exists within /oldbase
- # Make sure reboot exists within /oldbase
- # Make sure rm exists within /oldbase
- # Make sure sed exists within /oldbase
- # Make sure sh exists within /oldbase
- # Make sure sleep exists within /oldbase
- # Make sure stat exists within /oldbase
- # Make sure tar exists within /oldbase
- # Make sure xargs exists within /oldbase
- #################### Clear distribution schg flag: base/base
- cat "./../repos/8.1-RELEASE"/base/base.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: base/base
- cat "./../repos/8.1-RELEASE"/base/base.?? | tar --unlink -xzpvf - -C "/" --exclude etc/hosts --exclude etc/crontab --exclude etc/group --exclude etc/sysctl.conf --exclude etc/master.passwd --exclude etc/passwd --exclude etc/spwd.db --exclude etc/pwd.db --exclude etc/ssh/sshd_config --exclude boot/loader.conf
- #################### Employ distribution mtree(8): base/base
- mtree -eU -f ./../repos/8.1-RELEASE/base/base.mtree -p /
- #################### Clear distribution schg flag: kernels/fis
- cat "./../repos/8.1-RELEASE"/kernels/fis.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: kernels/fis
- cat "./../repos/8.1-RELEASE"/kernels/fis.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): kernels/fis
- mtree -eU -f ./../repos/8.1-RELEASE/kernels/fis.mtree -p /
- #################### Clear distribution schg flag: local/local
- cat "./../repos/8.1-RELEASE"/local/local.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: local/local
- cat "./../repos/8.1-RELEASE"/local/local.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): local/local
- mtree -eU -f ./../repos/8.1-RELEASE/local/local.mtree -p /
- #################### Clear distribution schg flag: perl/perl
- cat "./../repos/8.1-RELEASE"/perl/perl.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: perl/perl
- cat "./../repos/8.1-RELEASE"/perl/perl.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): perl/perl
- mtree -eU -f ./../repos/8.1-RELEASE/perl/perl.mtree -p /
- #################### Clear distribution schg flag: lib32/lib32
- # No such distribution for this release (ignore)
- #################### Unpack distribution contents: lib32/lib32
- # No such distribution for this release (ignore)
- #################### Employ distribution mtree(8): lib32/lib32
- # No such distribution for this release (ignore)
- #################### Clear distribution schg flag: doc/doc
- cat "./../repos/8.1-RELEASE"/doc/doc.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: doc/doc
- cat "./../repos/8.1-RELEASE"/doc/doc.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): doc/doc
- mtree -eU -f ./../repos/8.1-RELEASE/doc/doc.mtree -p /
- #################### Clear distribution schg flag: games/games
- cat "./../repos/8.1-RELEASE"/games/games.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: games/games
- cat "./../repos/8.1-RELEASE"/games/games.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): games/games
- mtree -eU -f ./../repos/8.1-RELEASE/games/games.mtree -p /
- #################### Clear distribution schg flag: manpages/manpages
- cat "./../repos/8.1-RELEASE"/manpages/manpages.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: manpages/manpages
- cat "./../repos/8.1-RELEASE"/manpages/manpages.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): manpages/manpages
- mtree -eU -f ./../repos/8.1-RELEASE/manpages/manpages.mtree -p /
- #################### Clear distribution schg flag: proflibs/proflibs
- cat "./../repos/8.1-RELEASE"/proflibs/proflibs.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: proflibs/proflibs
- cat "./../repos/8.1-RELEASE"/proflibs/proflibs.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): proflibs/proflibs
- mtree -eU -f ./../repos/8.1-RELEASE/proflibs/proflibs.mtree -p /
- #################### Clear distribution schg flag: dict/dict
- cat "./../repos/8.1-RELEASE"/dict/dict.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: dict/dict
- cat "./../repos/8.1-RELEASE"/dict/dict.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): dict/dict
- mtree -eU -f ./../repos/8.1-RELEASE/dict/dict.mtree -p /
- #################### Clear distribution schg flag: info/info
- cat "./../repos/8.1-RELEASE"/info/info.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
- #################### Unpack distribution contents: info/info
- cat "./../repos/8.1-RELEASE"/info/info.?? | tar --unlink -xzpvf - -C "/"
- #################### Employ distribution mtree(8): info/info
- mtree -eU -f ./../repos/8.1-RELEASE/info/info.mtree -p /
- #################### Run final mtree commands...
- mtree -eU -f /etc/mtree/BSD.root.dist -p /
- mtree -eU -f /etc/mtree/BSD.var.dist -p /var
- mtree -eU -f /etc/mtree/BSD.usr.dist -p /usr
- #################### Copy post-installation scripts...
- mkdir -p /dist
- cp -RPpfv ./../repos/8.1-RELEASE/druid /dist/
- cp -RPpfv ./../repos/8.1-RELEASE/run_once /dist/
- cp -RPpfv ./../repos/8.1-RELEASE/sys_custom /dist/
- find "/dist/sys_custom" -type d -name CVS -exec rm -Rfv '{}' ';'
- find "/dist/sys_custom" -type f -name .keep -exec rm -fv '{}' ';'
- #################### Make-way for sys_custom items...
- # Pre-unlink destination files
- rm -f "/usr/local/sbin/host-setup"
- #################### Install sys_custom items...
- env SHELL=/oldbase/sh PATH=/oldbase /oldbase/sh /dist/druid/syscustom
- #################### Prepare legacy pwd_mkdb(8) for run_once...
- cp -fv /usr/sbin/pwd_mkdb /usr/sbin/pwd_mkdb.xnew
- ln -sfv /oldbase/pwd_mkdb /usr/sbin/pwd_mkdb
- #################### Check dhclient.conf(5) configuration...
- # dhclient.conf(5) not configured (skip)
- #################### Execute post-installation scripts...
- env SHELL=/oldbase/sh PATH=/oldbase /oldbase/sh /dist/druid/run_once
- #################### Run 8.1-RELEASE specific post_install
- post_install
- # Remove `nodev' option from fstab(5) NFS mounts
- cp -pf /etc/fstab /etc/fstab.nodev.xbak-2013-07-08.10:57:34-4.11-STABLE
- awk '
- {
- if ( $0 !~ /^[[:space:]]*#/ && ( $3 == "nfs" ) )
- {
- sub(/^nodev$/, "none", $4)
- sub(/^nodev,/, "", $4)
- sub(/,nodev,/, ",", $4)
- sub(/,nodev$/, "", $4)
- }
- print
- }' "/etc/fstab.nodev.xbak-2013-07-08.10:57:34-4.11-STABLE" > "/etc/fstab"
- # Change `null' fstype in fstab(5) to `nullfs'
- cp -pf /etc/fstab /etc/fstab.null.xbak-2013-07-08.10:57:34-4.11-STABLE
- awk '
- {
- if ( $0 !~ /^[[:space:]]*#/ && ( $3 == "null" ) )
- {
- $3 = "nullfs"
- }
- print
- }' "/etc/fstab.null.xbak-2013-07-08.10:57:34-4.11-STABLE" > "/etc/fstab"
- # Change pass_no of `/var' filesystem to 2
- cp -pf /etc/fstab /etc/fstab.var.xbak-2013-07-08.10:57:34-4.11-STABLE
- awk '
- {
- if ( $0 !~ /^[[:space:]]*#/ && ( $2 == "/var" ) && !$NF )
- {
- sub(/[[:digit:]]+[[:space:]]*$/, "2")
- }
- print
- }' "/etc/fstab.var.xbak-2013-07-08.10:57:34-4.11-STABLE" > "/etc/fstab"
- # Fix `/bin/xauth' symbolic-link
- ln -sfv /usr/local/bin/xauth /bin/xauth
- # Remove old files/directories:
- # See `./etc/REMOVE_LIST-8.1' for a full listing
- # Move `/usr/local/etc/xdm' to `/usr/local/etc/xdm.xbak-2013-07-08.10:57:34-4.11-STABLE'
- mv -v /usr/local/etc/xdm /usr/local/etc/xdm.xbak-2013-07-08.10:57:34-4.11-STABLE
- #################### Clean up...
- rm -Rfv /dist
- mv -fv /usr/sbin/pwd_mkdb.xnew /usr/sbin/pwd_mkdb
- #################### End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement