3 # Create a working chroot for snapshot building
8 # slow and steady wins the race, don't interfere
11 #set ncpu = `sysctl -n hw.ncpu`
15 # needed for ports 'ex' script execution
19 echo "`$xdate` - SNAPSHOTS DOCLEAN BEGIN"
33 echo "Unknown option $arg"
34 echo "`$xdate` - SNAPSHOTS DOCLEAN END"
41 if ( "$build" == "" ) then
42 echo "build variable not set"
43 echo "`$xdate` - SNAPSHOTS DOCLEAN END"
47 if ( -e $build/root
/usr
/src
/nrelease
&& -e $build/root
/dev
/null
) then
48 echo "`$xdate` - Cleanup previous nrelease"
49 chroot
$build/root csh
-c "cd /usr/src/nrelease; make -DNOPROFILE -DWITHOUT_SRCS clean"
52 if ( -e $build/root
/dev
/null
) then
54 echo "`$xdate` - Unmount devfs from $build/root/dev"
55 umount
$build/root
/dev
57 echo "`$xdate` - Unable to umount $build/root/dev"
58 echo "`$xdate` - SNAPSHOTS DOCLEAN END"
64 umount
$build/root
/usr
/distfiles
>& /dev
/null
65 umount
$build/root
/usr
/src
>& /dev
/null
66 umount
$build/root
/usr
/dports
>& /dev
/null
68 if ( $?quick
== 0 ) then
69 echo "`$xdate` - Destroying root environment at $build/root"
71 rm -rf $build/root
>& /dev
/null
72 if ( -d $build/root
) then
73 chflags
-R noschg
$build/root
77 mkdir
-p $build/distfiles
79 mkdir
-p $build/root
/usr
81 echo "`$xdate` - Log files are in $build/*.out"
83 # Ignore quick/realquick options if there is no prior
86 if ( ! -e $build/root
/etc
/networks
) then
89 if ( ! -d $build/src
) then
93 if ( ! -d $build/dports
) then
98 # Clone the repos, create trakcing branches as necessary, checkout,
99 # and update (using fetch)
106 echo "`$xdate` - Cloning $dflygit"
107 git clone
-n $dflygit src
110 if ( "`git branch | fgrep $dfly_branch`" == "" ) then
111 echo "`$xdate` - Branching-src $dfly_branch"
112 git branch
$dfly_branch origin
/$dfly_branch
114 echo "`$xdate` - Updating src"
115 git checkout
$dfly_branch
121 if ( ! -d dports
) then
122 echo "`$xdate` - Cloning $dportsgit"
123 git clone
-n $dportsgit dports
126 if ( "`git branch | fgrep $dports_branch`" == "" ) then
127 echo "`$xdate` - Branching-dports $dports_branch"
128 git branch
$dports_branch origin
/$dports_branch
130 echo "`$xdate` - Updating dports"
131 git checkout
$dports_branch
137 mkdir
-p $build/root
/usr
/src
138 mkdir
-p $build/root
/usr
/dports
139 mkdir
-p $build/root
/usr
/distfiles
141 echo "`$xdate` - Mounting src, dports, distfiles"
142 mount_null
$build/src
$build/root
/usr
/src
143 mount_null
$build/dports
$build/root
/usr
/dports
144 mount_null
$build/distfiles
$build/root
/usr
/distfiles
149 # Install/upgrade environment
151 pushd $build/root
/usr
/src
153 if ( $?realquick
) then
154 echo "`$xdate` - Not running build/quickworld - realquick mode"
157 echo "`$xdate` - Starting quickworld, tail -f $build/build.out"
158 make -j $ncpu quickworld
>& $build/build.out
160 echo "`$xdate` - primary environment quickworld failed"
161 echo "`$xdate` - SNAPSHOTS DOCLEAN END"
165 echo "`$xdate` - Starting buildworld, tail -f $build/build.out"
166 make -j $ncpu buildworld
>& $build/build.out
168 echo "`$xdate` - primary environment buildworld failed"
169 echo "`$xdate` - SNAPSHOTS DOCLEAN END"
175 if ( $?realquick
== 0 ) then
176 echo "`$xdate` - Installing the world, tail -f $build/install.out"
177 make installworld DESTDIR
=$build/root
>& $build/install.out
179 make distribution DESTDIR
=$build/root
>& $build/install.out
181 echo "`$xdate` - Upgrading the world, tail -f $build/upgrade.out"
182 make upgrade DESTDIR
=$build/root
>& $build/upgrade.out
185 # Setup the chroot environment, including packages nrelease needs to
188 echo "`$xdate` - Setting up chroot environment in $build/root"
189 echo "`$xdate` - Mounting devfs"
190 if ( ! -e $build/root
/dev
/null
) then
191 mount_devfs dummy
$build/root
/dev
194 #mkdir -m 1777 $build/root/tmp
195 #mkdir -m 1777 $build/root/var/tmp
197 if ( $?realquick
== 0 ) then
198 echo "`$xdate` - Setting up ldd"
199 chroot
$build/root
/etc
/rc.d
/ldconfig start
201 cp /etc
/resolv.conf
$build/root
/etc
/
202 rm -rf $build/root
/usr
/obj
/dports
203 mkdir
-p $build/root
/usr
/obj
/dports
205 cat > $build/root
/etc
/make.conf
<< EOF
209 git_UNSET=CONTRIB PERL DIALOG
213 if ( ! -e $build/root
/usr
/local
/bin
/bmake
) then
214 echo "`$xdate` - Bootstrapping dports, tail -f $build/bootstrap.out"
215 chroot
$build/root csh
-c "cd /usr/dports/devel/bmake; make all install" >& $build/bootstrap.out
217 echo "`$xdate` - dports bootstrap had problems"
218 echo "`$xdate` - SNAPSHOTS DOCLEAN END"
223 # The nrelease build needs cdrecord and git. Try to get the binary package
224 # first and then build whatever else is needed from source. These packages
225 # are not part of the nrelease snapshot build, they are used by nrelease
228 if ( ! -e $build/root
/usr
/local
/bin
/mkisofs
) then
229 echo "`$xdate` - Setting up cdrecord and friends, tail -f $build/nrelease1.out"
230 #chroot $build/root csh -c "pkg_radd cdrecord"
231 if ( ! -e $build/root
/usr
/local
/bin
/mkisofs
) then
232 echo "`$xdate` - Binary package not found, building from source"
233 chroot
$build/root csh
-c "cd /usr/dports/sysutils/cdrtools; make -DBATCH all install"
237 if ( ! -e $build/root
/usr
/local
/bin
/git
) then
238 echo "`$xdate` - Setting up git from dports, tail -f $build/nrelease2.out"
239 #chroot $build/root csh -c "pkg_radd git"
240 if ( ! -e $build/root
/usr
/local
/bin
/git
) then
241 echo "`$xdate` - Binary package not found, building from source"
242 chroot
$build/root csh
-c "cd /usr/dports/devel/git; make -DBATCH all install"
246 echo "`$xdate` - SNAPSHOTS DOCLEAN END"