--- plamo/99_test/old/installer-20170304/PlamoBuild.installer-6.2 2017-03-04 11:43:30.000000000 +0900 +++ plamo/99_test/installer/PlamoBuild.installer-6.2 2017-08-17 11:26:18.000000000 +0900 @@ -18,6 +18,8 @@ ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/00_base/kbd/kbd-1.15-plamo-compat.patch.gz ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/00_base/kbd/kbd-1.15.5-revert_loadkeys_analize.patch.gz https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-175.tar.xz + ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/00_base/udev/udev-175-input-event-codes.patch.gz + ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/00_base/udev/udev-175-mtd_probe_stdint.patch.gz http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/00_base/ncurses/ncurses-6.0-Charable.patch.gz http://www.kernel.org/pub/linux/utils/util-linux/v2.28/util-linux-2.28.tar.xz @@ -33,6 +35,10 @@ ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/99_test/installer/installer-plamoinitrd.targz ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/99_test/installer/plamo_isolinux.tar.gz ftp://plamo.linet.gr.jp/pub/Plamo-src/plamo/99_test/installer/rpi_firmware.tar.gz" +verify= +digest= +branch= +commitid= pkgbase=installer vers=6.2 arch=`uname -m` @@ -55,27 +61,15 @@ src[15]=ntfs-3g_ntfsprogs-2016.2.22 src[16]=mdadm-3.2.3 src[17]=LVM2.2.02.90 -patchfiles[0]="" -patchfiles[1]="" -patchfiles[2]="" -patchfiles[3]="" -patchfiles[4]="" -patchfiles[5]="" patchfiles[6]="`echo tar-1.2{3-{tartime,txz},6-no-gets}.patch.gz`" -patchfiles[7]="" patchfiles[8]="`echo kbd-1.15-{backspace-1,plamo-compat}.patch.gz` kbd-1.15.5-revert_loadkeys_analize.patch.gz" -patchfiles[9]="" +patchfiles[9]="udev-175-input-event-codes.patch.gz + udev-175-mtd_probe_stdint.patch.gz" patchfiles[10]="ncurses-6.0-Charable.patch.gz" -patchfiles[11]="" -patchfiles[12]="" -patchfiles[13]="" -patchfiles[14]="" patchfiles[15]="ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch ntfs-3g_ntfsprogs-2016.2.22-libtool.patch" -patchfiles[16]="" patchfiles[17]="LVM2.2.02.90-static.patch" -OPT_CONFIG[0]="" OPT_CONFIG[1]="--enable-nls --with-ncursesw --enable-widec" OPT_CONFIG[2]="--enable-no-install-program=chroot,hostid,nice,who,users" OPT_CONFIG[2]+=",pinky,uptime,stty,df,stdbuf,[,base64,base32,basename,cat" @@ -88,12 +82,6 @@ OPT_CONFIG[2]+=",sha512sum,shred,shuf,sleep,sort,split,stat,sum,sync,tac" OPT_CONFIG[2]+=",tail,tee,test,timeout,touch,tr,true,truncate,tsort,tty" OPT_CONFIG[2]+=",uname,unexpand,uniq,unlink,vdir,wc,whoami,yes --without-gmp" -OPT_CONFIG[3]="" -OPT_CONFIG[4]="" -OPT_CONFIG[5]="" -OPT_CONFIG[6]="" -OPT_CONFIG[7]="" -OPT_CONFIG[8]="" OPT_CONFIG[9]="--libexecdir=/lib/udev --enable-static --disable-introspection --enable-rule_generator" OPT_CONFIG[10]="--without-debug --enable-widec --with-manpage-format=normal @@ -109,237 +97,36 @@ OPT_CONFIG[12]="--enable-symlink-install --disable-libuuid --disable-libblkid --disable-fsck --disable-e2initrd-helper --disable-uuidd" OPT_CONFIG[13]="--bindir=/sbin" -OPT_CONFIG[14]="" OPT_CONFIG[15]="--enable-really-static" -OPT_CONFIG[16]="" OPT_CONFIG[17]="--enable-static_link --enable-applib --enable-cmdlib --enable-pkgconfig --enable-dmeventd --with-thin=internal" DOCS="" -template=20170204 +template=20170713 tmplurl=ftp://plamo.linet.gr.jp/pub/Plamo-src/admin ###################################################################### -fscheck() { - PANGRAM="The quick brown fox jumps over the lazy dog." - echo -n "Checking for the filesystem ... " - mkdir pangram ; ( cd pangram ; touch $PANGRAM ) - mv pangram pangram~ ; mkdir pangram ; touch -r pangram~ pangram - tar cpf pangram.tar pangram ; rmdir pangram ; mv pangram~ pangram - for i in $PANGRAM ; do tar rpf pangram.tar pangram/$i ; done - touch -t `date '+%m%d0900'` pangram.tar ; gzip pangram.tar - touch pangram.tar.gz ; mv pangram.tar.gz pangram1.tgz - tar cpf pangram.tar pangram - touch -t `date '+%m%d0900'` pangram.tar ; gzip pangram.tar - touch pangram.tar.gz ; mv pangram.tar.gz pangram2.tgz - if cmp -s pangram1.tgz pangram2.tgz ; then - echo "OK" - rm -rf pangram pangram1.tgz pangram2.tgz - else - echo "NG" - cat <<- "EOF" - Hmm, packaging may not be done properly on this filesystem. - Would you please try again on a default filesystem, thanks! - - Happy packaging!! - - Quitting... - EOF - exit - fi -} - -install2() { - install -d ${2%/*} ; install -m 644 $1 $2 -} - -strip_bindir() { - echo "compressing in $1" - if [ -d $1 ] ; then ( - shopt -s nullglob - cd $1 - for i in * ; do - echo "$i" - if [ -h $i ] ; then continue ; fi - if [ -n "`file $i | grep "not stripped"`" ] ; then - echo "stripping -p $i" - strip -p $i - fi - done - ) fi -} - -strip_libdir() { - echo "compressing in $1" - if [ -d $1 ] ; then ( - shopt -s nullglob - cd $1 - for i in *.so *.so.* *.a ; do - echo "$i" - if [ -h $i ] ; then continue ; fi - if [ -n "`nm -a $i | grep " a "`" ] ; then - if [ $i != ${i%.a} ] ; then - echo -n "ranlib and " - touch -r $i $i.mt ; ranlib $i ; touch -r $i.mt $i ; rm $i.mt - fi - echo "stripping -gp $i" - strip -gp $i - fi - done - ) fi -} - -gzip_dir() { - echo "compressing in $1" - if [ -d $1 ] ; then ( - cd $1 - files=`ls -f --indicator-style=none | sed '/^\.\{1,2\}$/d'` - for i in $files ; do - echo "$i" - if [ ! -f $i -a ! -h $i -o $i != ${i%.gz} ] ; then continue ; fi - lnks=`ls -l $i | awk '{print $2}'` - if [ $lnks -gt 1 ] ; then - inum=`ls -i $i | awk '{print $1}'` - for j in `find . -maxdepth 1 -inum $inum` ; do - if [ ${j#./} == $i ] ; then - gzip -f $i - else - rm -f ${j#./} ; ln $i.gz ${j#./}.gz - fi - done - elif [ -h $i ] ; then - target=`readlink $i` ; rm -f $i ; ln -s $target.gz $i.gz - else - gzip $i - fi - done - for i in $files ; do mv ${i%.gz}.gz $C ; done - for i in $files ; do mv $C/${i%.gz}.gz . ; done - ) fi -} - -gzip_one() { - gzip $1 ; mv $1.gz $C ; mv $C/${1##*/}.gz ${1%/*} -} - -compress() { - for i in {$P,$P/usr}/{sbin,bin} ; do strip_bindir $i ; done - for i in {$P,$P/usr}/$libdir ; do strip_libdir $i ; done - if [ -f $infodir/dir ] ; then rm -f $infodir/dir ; fi - gzip_dir $infodir - for i in `seq 9` n ; do gzip_dir $mandir/man$i ; done -} - -prune_symlink() { - echo "pruning symlink in $1" - if [ -d $1 ] ; then ( - cd $P - rm -f /tmp/iNsT-a.$$ ; touch /tmp/iNsT-a.$$ - for i in `find ${1#$P/} -type l` ; do - target=`readlink $i` - echo "$i -> $target" - echo $i$'\n'$target >> /tmp/iNsT-a.$$ - done - COUNT=1 - LINE=`sed -n "${COUNT}p" /tmp/iNsT-a.$$` - while [ -n "$LINE" ] ; do - LINKGOESIN=`dirname $LINE` - LINKNAMEIS=`basename $LINE` - COUNT=$(($COUNT + 1)) - LINKPOINTSTO=`sed -n "${COUNT}p" /tmp/iNsT-a.$$` - if [ ! -d install ] ; then mkdir install ; fi - cat <<- EOF >> install/doinst.sh - ( cd $LINKGOESIN ; rm -rf $LINKNAMEIS ) - ( cd $LINKGOESIN ; ln -sf $LINKPOINTSTO $LINKNAMEIS ) - EOF - rm -rf $LINE ; touch -t `date '+%m%d0900'` install/doinst.sh $LINE - COUNT=$(($COUNT + 1)) - LINE=`sed -n "${COUNT}p" /tmp/iNsT-a.$$` - done - rm -f /tmp/iNsT-a.$$ - ) fi -} - -convert() { - for i in {$P,$P/usr}/{sbin,bin} ; do prune_symlink $i ; done - for i in {$P,$P/usr}/$libdir ; do prune_symlink $i ; done - prune_symlink $infodir - for i in `seq 9` n ; do prune_symlink $mandir/man$i ; done -} +if [ -f functions ] ; then + source ./functions +elif [ ! -f /usr/share/plamo/functions ] ; then + wget ftp://plamo.linet.gr.jp/pub/Plamo-src/admin/functions + source ./functions +else + source /usr/share/plamo/functions +fi fscheck -W=`pwd` -for i in `seq 0 $((${#src[@]} - 1))` ; do - S[$i]=$W/${src[$i]} ; B[$i]=$W/build`test ${#src[@]} -eq 1 || echo $i` -done -P=$W/work ; C=$W/pivot +prepare "$@" infodir=$P/share/info mandir=$P/share/man -docdir=$P/share/doc -myname=`basename $0` -pkg=$pkgbase-$vers-$arch-$build -case $arch in x86_64) libdir=lib64 ;; *) libdir=lib ;; esac -if [ $# -eq 0 ] ; then - opt_download=1 ; opt_config=1 ; opt_build=1 ; opt_package=1 -else - opt_download=0 ; opt_config=0 ; opt_build=0 ; opt_package=0 - for i in $@ ; do - case $i in - download) opt_download=1 ;; - config) opt_config=1 ;; - build) opt_build=1 ;; - package) opt_package=1 ;; - esac - done -fi +docdir=. if [ $opt_download -eq 1 ] ; then - for i in $url ; do - if [ ! -f ${i##*/} ] ; then - wget $i ; j=${i%.*} - for sig in asc sig{,n} {sha{256,1},md5}{,sum} ; do - if wget --spider $i.$sig ; then wget $i.$sig ; break ; fi - if wget --spider $j.$sig ; then - case ${i##*.} in - gz) gunzip -c ${i##*/} > ${j##*/} ;; - bz2) bunzip2 -c ${i##*/} > ${j##*/} ;; - xz) unxz -c ${i##*/} > ${j##*/} ;; - esac - touch -r ${i##*/} ${j##*/} ; i=$j ; wget $i.$sig ; break - fi - done - if [ -f ${i##*/}.$sig ] ; then - case $sig in - asc|sig|sign) gpg2 --verify ${i##*/}.$sig ;; - sha256|sha1|md5) ${sig}sum -c ${i##*/}.$sig ;; - *) $sig -c ${i##*/}.$sig ;; - esac - if [ $? -ne 0 ] ; then echo "archive verify failed" ; exit ; fi - fi - fi - done - for i in $url ; do - case ${i##*.} in - tar) tar xvpf ${i##*/} ;; - gz|tgz) tar xvpzf ${i##*/} ;; - bz2|tbz) tar xvpjf ${i##*/} ;; - xz|txz) tar xvpJf ${i##*/} ;; - esac - done + download_sources fi if [ $opt_config -eq 1 ] ; then for i in `seq 0 $((${#B[@]} - 1))` ; do if [ -d ${B[$i]} ] ; then rm -rf ${B[$i]} ; fi ; cp -a ${S[$i]} ${B[$i]} done - for i in `seq 0 $((${#B[@]} - 1))` ; do - cd ${B[$i]} - for j in ${patchfiles[$i]} ; do - case ${j##*.} in - gz) gunzip -c $W/$j | patch -Np1 -i - ;; - bz2) bunzip2 -c $W/$j | patch -Np1 -i - ;; - xz) unxz -c $W/$j | patch -Np1 -i - ;; - *) patch -Np1 -i $W/$j ;; - esac - done - done + apply_patches cd ${B[0]} cp -p $W/busybox-1.25.1-config .config cd ${B[2]} @@ -424,12 +211,6 @@ sed -i 's@$(ELDFLAGS) @@' daemons/dmeventd/Makefile.in for i in `seq 0 $((${#B[@]} - 1))` ; do cd ${B[$i]} - if [ -f [Mm]akefile ] ; then - make clean - fi - if [ -f config.log ] ; then - rm -rf config.cache config.log - fi if [ -x configure ] ; then ./configure --prefix= --sysconfdir=/etc --localstatedir=/var \ --libdir='${exec_prefix}'/$libdir --infodir='${prefix}'/share/info \ @@ -458,12 +239,7 @@ done fi if [ $opt_package -eq 1 ] ; then - if [ `id -u` -ne 0 ] ; then - read -p "Do you want to package as root? [y/N] " ans - if [ "x$ans" == "xY" -o "x$ans" == "xy" ] ; then - cd $W ; /bin/su -c "$0 package" ; exit - fi - fi + root_priv if [ -d $P ] ; then rm -rf $P ; fi ; mkdir -p $P if [ -d $C ] ; then rm -rf $C ; fi ; mkdir -p $C touch $W/i.st ; sleep 1 @@ -570,9 +346,9 @@ touch -t `date '+%m%d0900'` $K/efiboot.img else img=plamo-${vers}_${a}_`date '+%y%m%d'`_sd.img - fallocate -l 768M $img - cat <<- "EOF" | sfdisk $img - 8192,1564672,c,* + size=896 ; fallocate -l ${size}M $img + cat <<- EOF | sfdisk $img + 8192,$(((size - 4) * 2048)),c,* EOF loop=`losetup -f` losetup -P $loop $img @@ -608,38 +384,9 @@ cp -R --preserve=timestamps /mnt/work/Plamo-6.x/$a/$i $media fi done - for i in `seq 0 $((${#DOCS[@]} - 1))` ; do - for j in ${DOCS[$i]} ; do - for k in ${S[$i]}/$j ; do - install2 $k $docdir/${src[$i]}/${k#${S[$i]}/} - touch -r $k $docdir/${src[$i]}/${k#${S[$i]}/} - gzip_one $docdir/${src[$i]}/${k#${S[$i]}/} - done - done - if [ $i -eq 0 ] ; then - install $myname $media - touch -t `date '+%m%d0900'` $media/$myname - tmpl=${myname%%.*}-template-$template - if [ -f ../admin/$tmpl ] ; then - cp -p ../admin/$tmpl $media - else - ( cd $media - curl -Rs -o $tmpl $tmplurl/${tmpl/${myname%%.*}/PlamoBuild} ) - fi - spec=${myname%%.*}-spec - ( cd $media ; diff -u $tmpl $myname > $spec ) - touch -t `date '+%m%d0900'` $media/$spec - gzip $media/{$myname,$spec} - rm $media/$tmpl - mv $media/{$myname,$spec}.gz $C - mv $C/{$myname,$spec}.gz $media - else - ln $docdir/$src/$myname.gz $docdir/${src[$i]} - ln $docdir/$src/$spec.gz $docdir/${src[$i]} - fi - touch -t `date '+%m%d0900'` $media - done - false && convert + src=$media ; setup_docdir + touch -t `date '+%m%d0900'` $media + false && convert_links if [ $media == DVD ] ; then mkisofs -v -f -J -r -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ @@ -650,6 +397,5 @@ umount $media losetup -d $loop fi - read -p "Do you want to keep work files? [y/N] " ans - if [ "x$ans" != "xY" -a "x$ans" != "xy" ] ; then rm -rf $P $C i.[se]t ; fi + cleanup fi