Advertisement
devinteske

host_rebuild -nvr 8.1-RELEASE (run on a 4.11 box)

Jul 8th, 2013
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 11.51 KB | None | 0 0
  1. dteske@ipm0.dev.vicor.com tools $ ./host_rebuild -nvr 8.1-RELEASE  
  2. Rebuild / with repository 8.1-RELEASE
  3. TEST-ONLY! No actions will be performed.
  4. #################### Source 8.1-RELEASE specific config file
  5. . "./etc/8.1-RELEASE.conf"
  6. #################### Run 8.1-RELEASE specific pre_install
  7. pre_install
  8. # Preflight sanity check (check release)
  9. #    Migration from 4.11-STABLE to 8.1-RELEASE allowed
  10. # Prevent disappearance of tar(1)
  11. rm -Rfv /var/db/pkg/tar-1.5
  12. # Move `/usr/local/etc/rc.d' to `/usr/local/etc/rc.d.xbak-2013-07-08.10:57:34-4.11-STABLE'
  13. mv -v /usr/local/etc/rc.d /usr/local/etc/rc.d.xbak-2013-07-08.10:57:34-4.11-STABLE
  14. mkdir -pv /usr/local/etc/rc.d
  15. chmod -v 0755 /usr/local/etc/rc.d
  16. chown -v root:wheel /usr/local/etc/rc.d
  17. #################### Find/Remove core-dumps to free-up disk space
  18. find -x "/" -maxdepth 2 -name '*.core' -type f | xargs rm -fv
  19. #################### Back up /etc to /etc.xbak-2013-07-08.10:57:34-4.11-STABLE
  20. cp -RPpfv /etc /etc.xbak-2013-07-08.10:57:34-4.11-STABLE
  21. #################### Back up /usr/local/etc to /usr/local/etc.xbak-2013-07-08.10:57:34-4.11-STABLE
  22. cp -RPpfv /usr/local/etc /usr/local/etc.xbak-2013-07-08.10:57:34-4.11-STABLE
  23. #################### Uninstall 342 packages...
  24. pkg_delete -fav
  25. #################### Prepare /oldbase directory
  26. cp -pfv ./crunch/rebuild_crunch4 /oldbase/rebuild_crunch4
  27. ln -sfv rebuild_crunch4 /oldbase/cat
  28. ln -sfv rebuild_crunch4 /oldbase/chmod
  29. ln -sfv rebuild_crunch4 /oldbase/cp
  30. ln -sfv rebuild_crunch4 /oldbase/date
  31. ln -sfv rebuild_crunch4 /oldbase/ln
  32. ln -sfv rebuild_crunch4 /oldbase/ls
  33. ln -sfv rebuild_crunch4 /oldbase/mkdir
  34. ln -sfv rebuild_crunch4 /oldbase/mv
  35. ln -sfv rebuild_crunch4 /oldbase/rm
  36. ln -sfv rebuild_crunch4 /oldbase/sh
  37. ln -sfv rebuild_crunch4 /oldbase/sleep
  38. ln -sfv rebuild_crunch4 /oldbase/awk
  39. ln -sfv rebuild_crunch4 /oldbase/chflags
  40. ln -sfv rebuild_crunch4 /oldbase/chpass
  41. ln -sfv rebuild_crunch4 /oldbase/chsh
  42. ln -sfv rebuild_crunch4 /oldbase/env
  43. ln -sfv rebuild_crunch4 /oldbase/find
  44. ln -sfv rebuild_crunch4 /oldbase/sed
  45. ln -sfv rebuild_crunch4 /oldbase/stat
  46. ln -sfv rebuild_crunch4 /oldbase/xargs
  47. ln -sfv rebuild_crunch4 /oldbase/dialog
  48. ln -sfv rebuild_crunch4 /oldbase/gzip
  49. ln -sfv rebuild_crunch4 /oldbase/tar
  50. ln -sfv rebuild_crunch4 /oldbase/reboot
  51. ln -sfv rebuild_crunch4 /oldbase/chown
  52. ln -sfv rebuild_crunch4 /oldbase/chroot
  53. ln -sfv rebuild_crunch4 /oldbase/mtree
  54. ln -sfv rebuild_crunch4 /oldbase/pwd_mkdb
  55. #################### Sandbox myself into /oldbase
  56. # For csh(1) or tcsh(1):
  57. #    setenv SHELL "/oldbase/sh"
  58. #    setenv PATH  "/oldbase"
  59. #    rehash
  60. # For sh(1) or bash(1):
  61. #    export SHELL="/oldbase/sh"
  62. #    export PATH="/oldbase"
  63. #    hash -r
  64. #################### Perform final sanity checks
  65. # Make sure /oldbase exists
  66. # Make sure /oldbase is a directory
  67. # Make sure $SHELL exists in /oldbase
  68. # Make sure awk exists within /oldbase
  69. # Make sure cat exists within /oldbase
  70. # Make sure chflags exists within /oldbase
  71. # Make sure chmod exists within /oldbase
  72. # Make sure chown exists within /oldbase
  73. # Make sure chpass exists within /oldbase
  74. # Make sure chroot exists within /oldbase
  75. # Make sure chsh exists within /oldbase
  76. # Make sure cp exists within /oldbase
  77. # Make sure date exists within /oldbase
  78. # Make sure dialog exists within /oldbase
  79. # Make sure env exists within /oldbase
  80. # Make sure find exists within /oldbase
  81. # Make sure gzip exists within /oldbase
  82. # Make sure ln exists within /oldbase
  83. # Make sure ls exists within /oldbase
  84. # Make sure mkdir exists within /oldbase
  85. # Make sure mtree exists within /oldbase
  86. # Make sure mv exists within /oldbase
  87. # Make sure pwd_mkdb exists within /oldbase
  88. # Make sure reboot exists within /oldbase
  89. # Make sure rm exists within /oldbase
  90. # Make sure sed exists within /oldbase
  91. # Make sure sh exists within /oldbase
  92. # Make sure sleep exists within /oldbase
  93. # Make sure stat exists within /oldbase
  94. # Make sure tar exists within /oldbase
  95. # Make sure xargs exists within /oldbase
  96. #################### Clear distribution schg flag: base/base
  97. cat "./../repos/8.1-RELEASE"/base/base.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  98. #################### Unpack distribution contents: base/base
  99. 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
  100. #################### Employ distribution mtree(8): base/base
  101. mtree -eU -f ./../repos/8.1-RELEASE/base/base.mtree -p /
  102. #################### Clear distribution schg flag: kernels/fis
  103. cat "./../repos/8.1-RELEASE"/kernels/fis.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  104. #################### Unpack distribution contents: kernels/fis
  105. cat "./../repos/8.1-RELEASE"/kernels/fis.?? | tar --unlink -xzpvf - -C "/"
  106. #################### Employ distribution mtree(8): kernels/fis
  107. mtree -eU -f ./../repos/8.1-RELEASE/kernels/fis.mtree -p /
  108. #################### Clear distribution schg flag: local/local
  109. cat "./../repos/8.1-RELEASE"/local/local.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  110. #################### Unpack distribution contents: local/local
  111. cat "./../repos/8.1-RELEASE"/local/local.?? | tar --unlink -xzpvf - -C "/"
  112. #################### Employ distribution mtree(8): local/local
  113. mtree -eU -f ./../repos/8.1-RELEASE/local/local.mtree -p /
  114. #################### Clear distribution schg flag: perl/perl
  115. cat "./../repos/8.1-RELEASE"/perl/perl.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  116. #################### Unpack distribution contents: perl/perl
  117. cat "./../repos/8.1-RELEASE"/perl/perl.?? | tar --unlink -xzpvf - -C "/"
  118. #################### Employ distribution mtree(8): perl/perl
  119. mtree -eU -f ./../repos/8.1-RELEASE/perl/perl.mtree -p /
  120. #################### Clear distribution schg flag: lib32/lib32
  121. # No such distribution for this release (ignore)
  122. #################### Unpack distribution contents: lib32/lib32
  123. # No such distribution for this release (ignore)
  124. #################### Employ distribution mtree(8): lib32/lib32
  125. # No such distribution for this release (ignore)
  126. #################### Clear distribution schg flag: doc/doc
  127. cat "./../repos/8.1-RELEASE"/doc/doc.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  128. #################### Unpack distribution contents: doc/doc
  129. cat "./../repos/8.1-RELEASE"/doc/doc.?? | tar --unlink -xzpvf - -C "/"
  130. #################### Employ distribution mtree(8): doc/doc
  131. mtree -eU -f ./../repos/8.1-RELEASE/doc/doc.mtree -p /
  132. #################### Clear distribution schg flag: games/games
  133. cat "./../repos/8.1-RELEASE"/games/games.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  134. #################### Unpack distribution contents: games/games
  135. cat "./../repos/8.1-RELEASE"/games/games.?? | tar --unlink -xzpvf - -C "/"
  136. #################### Employ distribution mtree(8): games/games
  137. mtree -eU -f ./../repos/8.1-RELEASE/games/games.mtree -p /
  138. #################### Clear distribution schg flag: manpages/manpages
  139. cat "./../repos/8.1-RELEASE"/manpages/manpages.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  140. #################### Unpack distribution contents: manpages/manpages
  141. cat "./../repos/8.1-RELEASE"/manpages/manpages.?? | tar --unlink -xzpvf - -C "/"
  142. #################### Employ distribution mtree(8): manpages/manpages
  143. mtree -eU -f ./../repos/8.1-RELEASE/manpages/manpages.mtree -p /
  144. #################### Clear distribution schg flag: proflibs/proflibs
  145. cat "./../repos/8.1-RELEASE"/proflibs/proflibs.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  146. #################### Unpack distribution contents: proflibs/proflibs
  147. cat "./../repos/8.1-RELEASE"/proflibs/proflibs.?? | tar --unlink -xzpvf - -C "/"
  148. #################### Employ distribution mtree(8): proflibs/proflibs
  149. mtree -eU -f ./../repos/8.1-RELEASE/proflibs/proflibs.mtree -p /
  150. #################### Clear distribution schg flag: dict/dict
  151. cat "./../repos/8.1-RELEASE"/dict/dict.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  152. #################### Unpack distribution contents: dict/dict
  153. cat "./../repos/8.1-RELEASE"/dict/dict.?? | tar --unlink -xzpvf - -C "/"
  154. #################### Employ distribution mtree(8): dict/dict
  155. mtree -eU -f ./../repos/8.1-RELEASE/dict/dict.mtree -p /
  156. #################### Clear distribution schg flag: info/info
  157. cat "./../repos/8.1-RELEASE"/info/info.?? | tar tzf - | sed -e "s:^/::;s:^\(\./\)\{0,1\}:/:" | xargs chflags noschg
  158. #################### Unpack distribution contents: info/info
  159. cat "./../repos/8.1-RELEASE"/info/info.?? | tar --unlink -xzpvf - -C "/"
  160. #################### Employ distribution mtree(8): info/info
  161. mtree -eU -f ./../repos/8.1-RELEASE/info/info.mtree -p /
  162. #################### Run final mtree commands...
  163. mtree -eU -f /etc/mtree/BSD.root.dist -p /
  164. mtree -eU -f /etc/mtree/BSD.var.dist -p /var
  165. mtree -eU -f /etc/mtree/BSD.usr.dist -p /usr
  166. #################### Copy post-installation scripts...
  167. mkdir -p /dist
  168. cp -RPpfv ./../repos/8.1-RELEASE/druid /dist/
  169. cp -RPpfv ./../repos/8.1-RELEASE/run_once /dist/
  170. cp -RPpfv ./../repos/8.1-RELEASE/sys_custom /dist/
  171. find "/dist/sys_custom" -type d -name CVS -exec rm -Rfv '{}' ';'
  172. find "/dist/sys_custom" -type f -name .keep -exec rm -fv '{}' ';'
  173. #################### Make-way for sys_custom items...
  174. # Pre-unlink destination files
  175. rm -f "/usr/local/sbin/host-setup"
  176. #################### Install sys_custom items...
  177. env SHELL=/oldbase/sh PATH=/oldbase /oldbase/sh /dist/druid/syscustom
  178. #################### Prepare legacy pwd_mkdb(8) for run_once...
  179. cp -fv /usr/sbin/pwd_mkdb /usr/sbin/pwd_mkdb.xnew
  180. ln -sfv /oldbase/pwd_mkdb /usr/sbin/pwd_mkdb
  181. #################### Check dhclient.conf(5) configuration...
  182. # dhclient.conf(5) not configured (skip)
  183. #################### Execute post-installation scripts...
  184. env SHELL=/oldbase/sh PATH=/oldbase /oldbase/sh /dist/druid/run_once
  185. #################### Run 8.1-RELEASE specific post_install
  186. post_install
  187. # Remove `nodev' option from fstab(5) NFS mounts
  188. cp -pf /etc/fstab /etc/fstab.nodev.xbak-2013-07-08.10:57:34-4.11-STABLE
  189. awk '
  190. {
  191.     if ( $0 !~ /^[[:space:]]*#/ && ( $3 == "nfs" ) )
  192.     {
  193.         sub(/^nodev$/, "none", $4)
  194.         sub(/^nodev,/, "", $4)
  195.         sub(/,nodev,/, ",", $4)
  196.         sub(/,nodev$/, "", $4)
  197.     }
  198.     print
  199. }' "/etc/fstab.nodev.xbak-2013-07-08.10:57:34-4.11-STABLE" > "/etc/fstab"
  200. # Change `null' fstype in fstab(5) to `nullfs'
  201. cp -pf /etc/fstab /etc/fstab.null.xbak-2013-07-08.10:57:34-4.11-STABLE
  202. awk '
  203. {
  204.     if ( $0 !~ /^[[:space:]]*#/ && ( $3 == "null" ) )
  205.     {
  206.         $3 = "nullfs"
  207.     }
  208.     print
  209. }' "/etc/fstab.null.xbak-2013-07-08.10:57:34-4.11-STABLE" > "/etc/fstab"
  210. # Change pass_no of `/var' filesystem to 2
  211. cp -pf /etc/fstab /etc/fstab.var.xbak-2013-07-08.10:57:34-4.11-STABLE
  212. awk '
  213. {
  214.     if ( $0 !~ /^[[:space:]]*#/ && ( $2 == "/var" ) && !$NF )
  215.     {
  216.         sub(/[[:digit:]]+[[:space:]]*$/, "2")
  217.     }
  218.     print
  219. }' "/etc/fstab.var.xbak-2013-07-08.10:57:34-4.11-STABLE" > "/etc/fstab"
  220. # Fix `/bin/xauth' symbolic-link
  221. ln -sfv /usr/local/bin/xauth /bin/xauth
  222. # Remove old files/directories:
  223. #    See `./etc/REMOVE_LIST-8.1' for a full listing
  224. # Move `/usr/local/etc/xdm' to `/usr/local/etc/xdm.xbak-2013-07-08.10:57:34-4.11-STABLE'
  225. mv -v /usr/local/etc/xdm /usr/local/etc/xdm.xbak-2013-07-08.10:57:34-4.11-STABLE
  226. #################### Clean up...
  227. rm -Rfv /dist
  228. mv -fv /usr/sbin/pwd_mkdb.xnew /usr/sbin/pwd_mkdb
  229. #################### End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement