iwmfw - Add version 22 firmwares for AC3168 and AC8265 chipsets.
[dragonfly.git] / tools / snapshots / dobuild
blobea756a6ebbbf3595c7b069f6f1dfc38c07872da1
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 # needed for ports 'ex' script execution
14 setenv TERM xterm
16 echo "`$xdate` - SNAPSHOTS DOBUILD BEGIN"
18 # Options
20 set nrelease_args = "release"
22 foreach arg ( $argv )
23 switch ( $arg )
24 case "realquick":
25 set quick = 1
26 set realquick = 1
27 set nrelease_args = "realquick"
28 breaksw
29 case "quick":
30 set quick = 1
31 set nrelease_args = "quick"
32 breaksw
33 default:
34 echo "`$xdate` - Unknown option $arg"
35 echo "`$xdate` - SNAPSHOTS DOBUILD END"
36 exit 1
37 endsw
38 end
40 echo "`$xdate` - Setting up chroot environment"
41 if ( ! -e $build/root/dev/null ) then
42 mount_devfs dummy $build/root/dev
43 endif
45 sync; sleep 1
46 umount $build/root/usr/distfiles >& /dev/null
47 umount $build/root/usr/src >& /dev/null
48 umount $build/root/usr/dports >& /dev/null
49 sync; sleep 1
50 mount_null $build/distfiles $build/root/usr/distfiles
51 mount_null $build/src $build/root/usr/src
52 mount_null $build/dports $build/root/usr/dports
54 echo "`$xdate` - Build is running nrelease, tail -f $build/nrelease-build.out"
55 chroot $build/root csh -c "cd /usr/src/nrelease; make -DNOPROFILE -DWITHOUT_SRCS MAKE_JOBS=1 img $nrelease_args" >& $build/nrelease-build.out
57 if ( $? > 0 ) then
58 echo "`$xdate` - NRelease build had a problem, see $build/nrelease-build.out"
59 echo "`$xdate` - SNAPSHOTS DOBUILD END"
60 exit 1
61 endif
63 # Figure out the filename
65 set arch = `uname -p`
66 if ( "$arch" == "i386" ) then
67 set kobjs = $build/root/usr/obj/usr/src/sys/GENERIC
68 else
69 set kobjs = $build/root/usr/obj/usr/src/sys/X86_64_GENERIC
70 endif
72 if ( ! -f $kobjs/vers.txt ) then
73 echo "`$xdate` - nrelease build did not generate $kobjs/vers.txt"
74 echo "`$xdate` - SNAPSHOTS DOBUILD END"
75 exit 1
76 endif
78 # Store the snapshots. Make sure the files are inaccessible until
79 # completely written out.
81 set basename = `cat $kobjs/vers.txt`
82 mkdir -p $snapshots/$arch/images
83 mkdir -p $snapshots/$arch/kernels
84 set filepath = $snapshots/$arch
85 umask 077
86 bzip2 < $build/root/usr/obj/release/dfly.iso > $filepath/images/$basename.iso.bz2
87 bzip2 < $build/root/usr/obj/release/dfly.img > $filepath/images/$basename.img.bz2
88 (cd $build/root/usr/obj/release/root; tar cf - boot | bzip2 > $filepath/kernels/$basename.boot.tar.bz2)
89 chmod 644 $filepath/images/$basename.iso.bz2
90 chmod 644 $filepath/images/$basename.img.bz2
91 chmod 644 $filepath/kernels/$basename.boot.tar.bz2
92 sync
93 umask 022
94 pushd $filepath/images
95 md5 $basename.iso.bz2 >> CHECKSUM.MD5
96 md5 $basename.img.bz2 >> CHECKSUM.MD5
97 chmod 644 CHECKSUM.MD5
98 popd
100 pushd $filepath/kernels
101 md5 $basename.boot.tar.bz2 >> CHECKSUM.MD5
102 chmod 644 CHECKSUM.MD5
103 popd
105 # Only adjust the 'latest' softlink shortcuts for
106 # development snapshots. Release shortcuts have
107 # to be done manually.
109 if ( "$relsname" == "DEV" ) then
110 pushd $filepath
111 rm -f DragonFly-${arch}-LATEST-ISO.iso.bz2.new
112 rm -f DragonFly-${arch}-LATEST-IMG.img.bz2.new
113 rm -f DragonFly-${arch}-LATEST-BOOT.tar.bz2.new
114 ln -s images/$basename.iso.bz2 DragonFly-${arch}-LATEST-ISO.iso.bz2.new
115 ln -s images/$basename.img.bz2 DragonFly-${arch}-LATEST-IMG.img.bz2.new
116 ln -s kernels/$basename.boot.tar.bz2 DragonFly-${arch}-LATEST-BOOT.tar.bz2.new
117 mv -f DragonFly-${arch}-LATEST-ISO.iso.bz2.new \
118 DragonFly-${arch}-LATEST-ISO.iso.bz2
119 mv -f DragonFly-${arch}-LATEST-IMG.img.bz2.new \
120 DragonFly-${arch}-LATEST-IMG.img.bz2
121 mv -f DragonFly-${arch}-LATEST-BOOT.tar.bz2.new \
122 DragonFly-${arch}-LATEST-BOOT.tar.bz2
123 popd
124 endif
126 sync; sleep 1
127 umount $build/root/usr/distfiles >& /dev/null
128 umount $build/root/usr/src >& /dev/null
129 umount $build/root/usr/dports >& /dev/null
130 umount $build/root/dev >& /dev/null
132 echo "`$xdate` - SNAPSHOTS DOBUILD END"