kernel - Fix incorrect inode wait code in HAMMER
[dragonfly.git] / tools / snapshots / dobuild
blobccef9872432fa142b9ae94c4f0417e173e0863e9
1 #!/bin/csh
3 # Create a working chroot for snapshot building
6 source config
8 set ncpu = `sysctl -n hw.ncpu`
9 set pushdsilent
10 set xdate = "date"
12 echo "`$xdate` - SNAPSHOTS DOBUILD BEGIN"
14 # Options
16 set nrelease_args = "release"
18 foreach arg ( $argv )
19 switch ( $arg )
20 case "realquick":
21 set quick = 1
22 set realquick = 1
23 set nrelease_args = "realquick"
24 breaksw
25 case "quick":
26 set quick = 1
27 set nrelease_args = "quick"
28 breaksw
29 default:
30 echo "`$xdate` - Unknown option $arg"
31 echo "`$xdate` - SNAPSHOTS DOBUILD END"
32 exit 1
33 endsw
34 end
36 echo "`$xdate` - Setting up chroot environment"
37 if ( ! -e $build/root/dev/null ) then
38 mount_devfs dummy $build/root/dev
39 endif
41 umount $build/root/usr/pkgsrc/distfiles >& /dev/null
42 mount_null $build/distfiles $build/root/usr/pkgsrc/distfiles
44 setenv PKGSRC_PATH /usr/pkgsrc
46 echo "`$xdate` - Build is running nrelease, tail -f $build/nrelease-build.out"
47 chroot $build/root csh -c "cd /usr/src/nrelease; make -DNOPROFILE -DWITHOUT_SRCS img $nrelease_args" >& $build/nrelease-build.out
49 if ( $? > 0 ) then
50 echo "`$xdate` - NRelease build had a problem, see $build/nrelease-build.out"
51 echo "`$xdate` - SNAPSHOTS DOBUILD END"
52 exit 1
53 endif
55 # Figure out the filename
57 set arch = `uname -p`
58 if ( "$arch" == "i386" ) then
59 set kobjs = $build/root/usr/obj/usr/src/sys/GENERIC
60 else
61 set kobjs = $build/root/usr/obj/usr/src/sys/X86_64_GENERIC
62 endif
64 if ( ! -f $kobjs/vers.txt ) then
65 echo "`$xdate` - nrelease build did not generate $kobjs/vers.txt"
66 echo "`$xdate` - SNAPSHOTS DOBUILD END"
67 exit 1
68 endif
70 # Store the snapshots. Make sure the files are inaccessible until
71 # completely written out.
73 set basename = `cat $kobjs/vers.txt`
74 mkdir -p $snapshots/$arch/images
75 mkdir -p $snapshots/$arch/kernels
76 set filepath = $snapshots/$arch
77 umask 077
78 bzip2 < $build/root/usr/release/dfly.iso > $filepath/images/$basename.iso.bz2
79 bzip2 < $build/root/usr/release/dfly.img > $filepath/images/$basename.img.bz2
80 (cd $build/root/usr/release/root; tar cf - boot | bzip2 > $filepath/kernels/$basename.boot.tar.bz2)
81 chmod 644 $filepath/images/$basename.iso.bz2
82 chmod 644 $filepath/images/$basename.img.bz2
83 chmod 644 $filepath/kernels/$basename.boot.tar.bz2
84 sync
85 pushd $filepath/images
86 md5 $basename.iso.bz2 >> CHECKSUM.MD5
87 md5 $basename.img.bz2 >> CHECKSUM.MD5
88 popd
90 pushd $filepath/kernels
91 md5 $basename.boot.tar.bz2 >> CHECKSUM.MD5
92 popd
94 # Only adjust the 'latest' softlink shortcuts for
95 # development snapshots. Release shortcuts have
96 # to be done manually.
98 if ( "$relsname" == "DEV" ) then
99 pushd $filepath
100 rm -f DragonFly-${arch}-LATEST-ISO.iso.bz2.new
101 rm -f DragonFly-${arch}-LATEST-IMG.img.bz2.new
102 rm -f DragonFly-${arch}-LATEST-BOOT.tar.bz2.new
103 ln -s images/$basename.iso.bz2 DragonFly-${arch}-LATEST-ISO.iso.bz2.new
104 ln -s images/$basename.img.bz2 DragonFly-${arch}-LATEST-IMG.img.bz2.new
105 ln -s kernels/$basename.boot.tar.bz2 DragonFly-${arch}-LATEST-BOOT.tar.bz2.new
106 mv -f DragonFly-${arch}-LATEST-ISO.iso.bz2.new \
107 DragonFly-${arch}-LATEST-ISO.iso.bz2
108 mv -f DragonFly-${arch}-LATEST-IMG.img.bz2.new \
109 DragonFly-${arch}-LATEST-IMG.img.bz2
110 mv -f DragonFly-${arch}-LATEST-BOOT.tar.bz2.new \
111 DragonFly-${arch}-LATEST-BOOT.tar.bz2
112 popd
113 endif
115 sync
117 echo "`$xdate` - SNAPSHOTS DOBUILD END"