Advertisement
s243a

make-tazpup.sh

Mar 31st, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 21.41 KB | None | 0 0
  1. #!/bin/bash
  2. #written by mistfire, modified by s243a
  3. #Build TazPuppy either online or local
  4. curdir=`pwd`
  5. . $curdir/builder.cfg
  6. #. $curdir/pkg-dirs
  7. #LABEL1=""
  8. . $curdir/defaults
  9. xmode=${xmode:-""}
  10. xinteractive=${xinteractive:-""}
  11. branch=${branch:-"next64"}
  12. arch=${arch:-"x86_64"}
  13. prefix=${prefix:-"/64"}
  14.  
  15. if [ ! -f $curdir/builder.cfg ]; then
  16. echo 'WEBSITE="http://mirror1.slitaz.org/iso/rolling"
  17. LIVECD="slitaz-rolling-core.iso"' > $curdir/builder.cfg
  18. fi
  19.  
  20. ## Add function imports here
  21. source $curdir/build-scripts/make-tazpup_functions.sh
  22.  
  23. trap unmount_vfs EXIT
  24. trap unmount_vfs SIGKILL
  25. trap unmount_vfs SIGTERM
  26.  
  27.  
  28.  
  29. if [ "$(whoami)" != "root" ]; then
  30.   echo "Requires root access to do it"
  31.   exit
  32. fi
  33.  
  34. if [ "$(which Xdialog)" == "" ]; then
  35. echo "Requires Xdialog. Install it first"
  36. exit
  37. fi
  38.  
  39. if [ ! -w $curdir ]; then
  40.   echo "The working path is not writable"
  41.   exit
  42. fi
  43.  
  44. if [ ! -e $curdir/tazpup-core-files ]; then
  45.   echo "Core files are missing"
  46.   exit
  47. fi
  48.  
  49. select_build_mode #Function located in make-tazpup_functions
  50. select_interact_mode  #Function located in make-tazpup_functions
  51. select_force_custom  #Function located in make-tazpup_functions
  52. clean_up_some
  53. select_pup_img
  54.  
  55.  
  56. if [ "$xmode" == "online" ]; then
  57.  
  58.  if [ -f $curdir/$LIVECD ]; then
  59.  echo "Deleting $LIVECD..."
  60.  rm -rf $curdir/$LIVECD
  61.  fi
  62.  
  63.  download_iso
  64.  
  65. fi
  66.  
  67. prepare_working_folders
  68.  
  69. #------------------------------Extract Tazimage section -----------------------
  70. #TODO allow a puppy immage to be used instead of a SlITZ image
  71. #TODO maybe we don't need a base image if we just copy the package manager tazpkg and then install enough packages
  72.  
  73. echo "Mounting $(basename $IMG)..." #This is the build-system image and may also be the base immage
  74.  
  75. mount -o ro $IMG /mnt/wktaz
  76. #https://linuxize.com/post/how-to-mount-and-unmount-file-systems-in-linux/
  77. #mount $IMG /mnt/wktaz -o loop
  78.  
  79. if [ $? -ne 0 ]; then
  80.   echo "Mounting slitaz image failed"
  81.   exit
  82. fi
  83.  
  84. if [ -f /mnt/wktaz/rootfs.gz ] || [ -f /mnt/wktaz/rootfs1.gz ]; then
  85.   echo "Copying rootfs gz..."
  86.   src1="/mnt/wktaz/rootfs*.gz"
  87. elif [ -f /mnt/wktaz/boot/rootfs.gz ] || [ -f /mnt/wktaz/boot/rootfs1.gz ]; then
  88.   echo "Copying rootfs gz..."
  89.   src1="/mnt/wktaz/boot/rootfs*.gz"
  90. #elif   TODO add alternative option if iso isn't found
  91.  
  92. else
  93.   echo "Not a slitaz disc image"
  94.   umount /mnt/wktaz
  95.   exit
  96. fi
  97.  
  98. cp -f $src1 $curdir/slitaz-livecd-wkg/
  99.  
  100. umount /mnt/wktaz
  101.  
  102. cd $curdir/slitaz-livecd-wkg
  103.  
  104. rcount=$(ls -1 ./rootfs*.gz | wc -l)
  105.  
  106. if [ $rcount -eq 1 ]; then
  107.  echo "Extracting rootfs gz..."
  108.  extractfs $curdir/slitaz-livecd-wkg/rootfs.gz
  109.  BaseImageExtracted=1
  110. elif [ $rcount -gt 1 ]; then
  111.     for rf1 in $(ls -1 ./rootfs*.gz | sort -r)
  112.     do
  113.      echo "Extracting $(basename $rf1)..."
  114.      extractfs $rf16
  115.     done
  116.      BaseImageExtracted=1
  117. else
  118.  echo "No rootfs found"
  119.  # exit See notes above of maybe not needing a base image
  120. # read -p "Press enter to continue"
  121.  BaseImageExtracted=0
  122. fi
  123.  
  124. if [ $BaseImageExtracted -eq 1 ]; then
  125.   rm -rf $curdir/slitaz-livecd-wkg
  126.  
  127.   remove_some_slitaz
  128.   rm -rf $curdir/slitaz-rootfs/var/www/tazpanel/menu.d/network/*
  129.  
  130.   for file1 in $(find $curdir/slitaz-rootfs/usr/share/icons/ -type f -name "application-x-executable.png")
  131.   do
  132.     if [ -L $file1 ]; then
  133.     fname=$(readlink $file1)
  134.       if [ "$fname" != "" ]; then
  135.           if [ "$(basename $fname)" == "application-x-generic.png" ]; then
  136.           rm -f $file1
  137.           fi
  138.       fi
  139.     fi
  140.   done
  141.  
  142.   for file1 in $(find $curdir/slitaz-rootfs/usr/share/icons/ -type f -name "application-x-generic.png")
  143.   do
  144.     mv -f $file1 $(dirname $file1)/application-x-executable.png
  145.   done
  146. fi #TODO add else option for using a puppy image instead
  147. # End Tazimage Section ---------------------------------------------------------------
  148. #exit
  149. make_pupcore #I think we always want to do this but will think more about it.
  150. mkdir -p $curdir/slitaz-rootfs$prefix/usr/share/boot
  151. mkdir -p $curdir/slitaz-rootfs$prefix/usr/bin
  152.  
  153. if [ $BaseImageExtracted -eq 1 ]; then
  154.   select_copy_tazpkg_in_build_env
  155. else
  156.   cpytaz=1
  157. fi
  158. #TODO add some build architecture logic here: check that prefix makes sense.
  159. #cp --remove-destination -arf $curdir/tazpup-core-files/build/amd64/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  160. #cp -f $curdir/tazpup-core-files/build/no-arch/bin/$fullcmd $curdir/slitaz-rootfs$prefix/bin/$fullcmd
  161. if [ $cpytaz -eq 1 ]; then
  162.   #These next four statments have been replaced by a single statment (s243a)
  163.   #The intent is to copy tazpkg into the build system. This isn't necissary if tazpkg is included in the base image.
  164.   #cp -f $curdir/tazpup-core-files/slitaz/usr/bin/tazpkg $curdir/slitaz-rootfs$prefix/usr/bin/tazpkg
  165.   #cp -f $curdir/tazpup-core-files/slitaz/usr/bin/active-networks $curdir/slitaz-rootfs$prefix/usr/bin/active-networks
  166.   #mkdir -p $curdir/slitaz-rootfs$prefix/usr/libexec/tazpkg/
  167.   #cp -f $curdir/tazpup-core-files/slitaz/usr/libexec/tazpkg/* $curdir/slitaz-rootfs$prefix/usr/libexec/tazpkg/
  168.   cp --remove-destination -arf $curdir/tazpup-core-files/tazpkg/* $curdir/slitaz-rootfs/ 2>/dev/null
  169.  
  170. fi
  171.   #Not sure whether or not the next two statments should be in the above iff block @s243a
  172.   #I think these two scripts are custom and might be useful for the build system (to re-evaluate (s243a)
  173.   cp -f $curdir/tazpup-core-files/slitaz/usr/bin/tazpet $curdir/slitaz-rootfs/usr/bin/tazpet
  174.   cp -f $curdir/tazpup-core-files/slitaz/usr/bin/tazpet-box $curdir/slitaz-rootfs/usr/bin/tazpet-box
  175.  
  176. #exit
  177.  
  178. echo "SliTaZ Extracted"
  179. #read -p "Press enter to continue"
  180.  
  181.  
  182. if [ ! -d $curdir/slitaz-rootfs ]; then
  183.  echo "Extract rootfs failed"
  184.  exit
  185. fi
  186.  
  187. rm -f $curdir/slitaz-rootfs$prefix/init
  188.  
  189. cd $curdir
  190. mkdir -p $curdir/slitaz-rootfs$prefix/pkgs
  191. #Copy The following directories into the workspace
  192. #pkgs/slitaz-base pkgs/slitaz-dependencies pkgs/slitaz-packages pkgs/slitaz-preinst-pkg
  193. #these directory names come from the array pkg_dirs_to_copy
  194. for aDir in "${pkg_dirs_to_copy[@]}"; do # $pkgs/slitaz-base pkgs/slitaz-dependencies pkgs/slitaz-packages pkgs/slitaz-preinst-pkg; do
  195.   if [ ! -d $aDir ]; then
  196.     if [ ${aDir:0:1} = "/" ]; then
  197.       $curdir$aDir
  198.     else
  199.       $curdir/$aDir
  200.     fi
  201.   fi
  202.   cp --remove-destination -arf $aDir/* $curdir/slitaz-rootfs$prefix/pkgs #2>/dev/null
  203. done
  204.  
  205.  
  206.  
  207. cd $curdir
  208. mount -o rbind /proc $curdir/slitaz-rootfs/proc #TODO also added mounts in $curdir/slitaz-rootfs$prefix
  209. mount -t sysfs none $curdir/slitaz-rootfs/sys
  210. if [ $xinteractive -eq 1 ]; then
  211.  echo "Removing block device files..."
  212.  #rm -rf $curdir/slitaz-rootfs/dev/*
  213.  mv $curdir/slitaz-rootfs/dev-back $curdir/slitaz-rootfs/dev-back
  214.  #mount bind -t devtmpfs none $curdir/slitaz-rootfs/dev
  215.  mount -o rbind /dev $curdir/slitaz-rootfs/dev
  216.  cp -f /etc/resolv.conf $curdir/slitaz-rootfs/etc/resolv.conf
  217. fi
  218.  
  219.  
  220.  
  221.  
  222.  
  223. #exit
  224.  
  225. #install_pkg $curdir/slitaz-packages/readline-7.0-x86_64.tazpkg
  226. #install_pkg $curdir/slitaz-packages/bash-4.4.p23-x86_64.tazpkg
  227. #install_pkg $curdir/extract/busybox-1.27.2-x86_64.tazpkg
  228. #cp -f $curdir/extract/busybox-1.27.2-x86_64.tazpkg.extracted/fs/bin/busybox $curdir/slitaz-rootfs/bin/busybox
  229. while read aFile; do
  230.    install_pkg $curdir/pkgs/slitaz-preinst-pkg/$aFile
  231.    post_inst_fixes $pkg
  232. done <$slitaz_preinst_pkg_dir/files.txt
  233. #TODO append file in directory to files.txt that aren't already on the list
  234. #TODO remove from list any files that are not in the directory, unless flagged for remote download.
  235. #TODO consider using tazpkg in the prefix folder at this point.
  236.  
  237. #TODO add some build architecture logic here: check that prefix makes sense.
  238. cp --remove-destination -arf $curdir/tazpup-core-files/build/amd64/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null  
  239.  
  240. if [ cpy_unknown -eq 1 ]; then
  241.   cp --no-clobber -arf $curdir/tazpup-core-files/unknown/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  242. fi
  243.  
  244.  
  245. echo "Fishished slitaz-preinst-pkg"
  246. #read -p "Press enter to continue" #added by s243a
  247.  
  248. echo "Installing Base Slitaz packages..."
  249. #TODO, add option to skip this if someone inserted a base CD.
  250. for pkg in $(find $slitaz_base_pkg_dir -type f -name "*.tazpkg" | sort -r)
  251. do
  252.     echo "Processing core package: $(basename $pkg)"
  253.     install_pkg "$pkg"
  254. done
  255.  
  256. #cp $curdir/slitaz-post-patch-packages/coreutils-multicall-8.30-x86_64.tazpkg $curdir/slitaz-rootfs$prefix/pkgs/coreutils-multicall-8.30-x86_64.tazpkg
  257. #install_pkg $curdir/slitaz-post-patch-packages/coreutils-multicall-8.30-x86_64.tazpkg
  258.  
  259. #Comment out for now as I think this gets installed as a dependency
  260.  
  261. #For some reason 32bit libs are getting installed earlier and we need to overwrite them
  262. install_pkg $curdir/pkgs/applications/dependencies/next64/gconf-3.2.6-x86_64.tazpkg --forced #TODO figure out if we can do this earlier
  263.  
  264. cp $curdir/pkgs/slitaz-post-patch-packages/eudev-3.2.7-x86_64.tazpkg $curdir/slitaz-rootfs$prefix/pkgs/eudev-3.2.7-x86_64.tazpkg
  265. install_pkg $curdir/pkgs/slitaz-post-patch-packages/eudev-3.2.7-x86_64.tazpkg
  266. #TODO add eudev and udev to the package block list
  267.  
  268. add_locks_and_blockFiles
  269.  
  270. echo "Processing Additional Slitaz packages..."
  271.  
  272. # Let's just be explicit in what we want:
  273. if [ "$xmode" == "local" ]; then
  274.  install_local_pkgs "$slitaz_packages_dir" "$special_packages_dir"
  275. else
  276.  echo "coud mode under re-construction"
  277.  install_online_pkg
  278. fi
  279.  
  280. #http://murga-linux.com/puppy/viewtopic.php?t=115306
  281.  
  282. #exit
  283.  
  284. #if [ -d $curdir/custom-packages ]; then
  285. #   for pkg in $(find $curdir/custom-packages -type f -name "*.tazpkg")
  286. #   do
  287. #   echo "Processing custom package: $(basename $pkg)"
  288. #   install_pkg "$pkg"
  289. #   done
  290. #fi
  291.  
  292.  
  293. #if [ -d $curdir/pkgs/pet-packages ]; then
  294. #   for pkg in $(find $curdir/pet-packages -type f -name "*.pet")
  295. #   do
  296. #     echo "Processing pet package: $(basename $pkg)"
  297. #     install_pet_pkg "$pkg"
  298. #     donefor pkg in $(find $curdir/converted-aliens -type f -name "*.tazpkg" | sort -r)
  299. #   done
  300. #
  301. #fi
  302.  
  303. for pkg in $(find $converted_aliens_pkg_dir -type f -name "*.tazpkg" | sort -r)
  304. do
  305.   echo "Processing converted aliens: $(basename $pkg)"
  306.   install_pkg "$pkg"
  307. done
  308.  
  309. #### Let's Give Some Choices For Applications ####
  310.  
  311. for Ap_Type in "console_editors" "terminal_emulators" "text_editors" "graphics" "games"; do
  312.   Applications_TO_INSTALL="TO_INSTALL_$Ap_Type"
  313.   is_array "$Applications_TO_INSTALL"
  314.   if [ ! is_array_rtn ]; then
  315.     if [ "${#Applications_TO_INSTALL}" -gt 0 ]; then
  316.        Applications_TO_INSTALL=( ${Applications_TO_INSTALL//,/$IFS} )
  317.     fi
  318.   fi
  319.   #if [ is_array_rtn -eq 1 ]; then
  320.     #if [ ${#myvar} -gt 0 ]; then
  321.     #  Applicatoins_TO_INSTALL=( "$TextEditors_TO_INSTALL" )
  322.     #else
  323.     #  set_Applications_TO_INSTALL
  324.     #  Applicatoins_TO_INSTALL="$set_Applications_TO_INSTALL_rtn"
  325.     #fi
  326.     for application in "${Applications_TO_INSTALL[@]}"; do
  327.      
  328.       app_path=$curdir/pkgs/applications/$Ap_Type/$application
  329.       #if [ -d "$app_path/$branch" ]; then
  330.         install_pkgs_fm_dir "$app_path" #see $curdir/build-scripts/make-tazpup_functions.sh
  331.       #fi
  332.       #install_pkg "$app_path"
  333.     done
  334.   #fi
  335. done
  336.  
  337. for woof_pkg in "${WOOF_CE_PKGS_TO_INSTALL[@]}"; do
  338.   install_woofCE_pkg "$woof_pkg"
  339. done
  340. echo "Applying patches..."
  341.  
  342. #Somd utilities in procps link to missing library libproc-3.2.8.so
  343. while read -r line; do #https://unix.stackexchange.com/questions/85060/getting-relative-links-between-two-paths
  344.   #https://stackoverflow.com/questions/9293887/reading-a-delimited-string-into-an-array-in-bash
  345.   #https://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_10_02.html
  346.   arr=($line)
  347.   target_f=$curdir/slitaz-rootfs$prefix${arr[0]}
  348.   source_f=${arr[1]}
  349.   if [ -f $target_f ]; then
  350.    
  351.     fname=`basename $target_f`
  352.     target_d=`dirname $target_f`
  353.     mv $target_f $target_d/$fname-old
  354.     cd $target_d
  355.     pwd
  356.     ln -s $source_f $fname
  357.   fi
  358. done <<EOM
  359. /bin/uname busybox
  360. /sbin/sysctl ../bin/busybox
  361. /bin/ps busybox
  362. /bin/kill busybox
  363. /usr/bin/w ../../bin/busybox
  364. /usr/bin/pmap ../../bin/busybox
  365. /usr/bin/free ../../bin/busybox
  366. /usr/bin/uptime ../../bin/busybox
  367. /usr/bin/pkill ../../bin/busybox
  368. /usr/bin/pgrep ../../bin/busybox
  369. /usr/bin/top ../../bin/busybox
  370. /usr/bin/watch ../../bin/busybox
  371. EOM
  372.  
  373.  
  374. #chroot "$curdir/slitaz-rootfs/" tazpkg setup-mirror http://mirror.slitaz.org/packages/next64/
  375. echo "http://mirror.slitaz.org/packages/next64/">$curdir/slitaz-rootfs$prefix/var/lib/tazpkg/mirror
  376.  
  377. cp --remove-destination -arf $curdir/tazpup-core-files/slitaz/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  378. cp --remove-destination -arf $curdir/tazpup-core-files/puppy/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  379. #TODO add some build architecture logic here: check that prefix makes sense.
  380. cp --remove-destination -arf $curdir/tazpup-core-files/build/amd64/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387. make_pupcore
  388.  
  389. if [ -f $curdir/slitaz-rootfs$prefix/usr/sbin/hald ]; then
  390.  mv -f $curdir/slitaz-rootfs$prefix/usr/sbin/hald $curdir/slitaz-rootfs$prefix/usr/bin/hald
  391.  sed -i -e "s#\/usr\/sbin\/hald#\/usr\/bin\/hald#g" $curdir/slitaz-rootfs$prefix/var/lib/tazpkg/installed/hal/files.list
  392.  sed -i -e "s#\/usr\/sbin\/hald#\/usr\/bin\/hald#g" $curdir/slitaz-rootfs$prefix/var/lib/tazpkg/installed/hal/md5sum
  393.  sed -i -e "s#\/usr\/sbin\/hald#\/usr\/bin\/hald#g" $curdir/slitaz-rootfs$prefix/etc/init.d/hald
  394. fi
  395.  
  396. if [ -f $curdir/slitaz-rootfs$prefix/usr/share/applications/defaults.list ]; then
  397.  rm -f $curdir/slitaz-rootfs$prefix/usr/share/applications/defaults.list
  398. fi
  399.  
  400. mkdir -p $curdir/slitaz-rootfs$prefix/etc/rc.d/
  401. echo "PUPMODE='2'" > $curdir/slitaz-rootfs$prefix/etc/rc.d/PUPSTATE
  402.  
  403. if [ -f $curdir/slitaz-rootfs$prefix/usr/bin/coreutils ]; then
  404.     echo '#!/bin/sh
  405.     exec df $@' > $curdir/slitaz-rootfs$prefix/usr/bin/df-FULL
  406.     chmod +x $curdir/slitaz-rootfs$prefix/usr/bin/df-FULL
  407. fi
  408.  
  409. if [ -f $curdir/slitaz-rootfs$prefix/usr/bin/gzip ]; then
  410.     rm -f  $curdir/slitaz-rootfs$prefix/bin/gzip
  411. fi
  412. if [ -f $curdir/slitaz-rootfs$prefix/usr/bin/lzma ]; then #Added by s243a
  413.     rm -f  $curdir/slitaz-rootfs$prefix/bin/lzma
  414. fi
  415.  
  416.  
  417. if [ -d $curdir/slitaz-rootfs$prefix/usr/lib/grub/i386-slitaz ]; then
  418.     ln -sr $curdir/slitaz-rootfs$prefix/usr/lib/grub/i386-slitaz $curdir/slitaz-rootfs$prefix/usr/lib/grub/i386-pc
  419.     ln -sr $curdir/slitaz-rootfs$prefix/usr/lib/grub/i386-slitaz $curdir/slitaz-rootfs$prefix/usr/lib/grub/i386-t2
  420. fi
  421.  
  422. if [ -d $curdir/slitaz-rootfs$prefix/usr/share/boot ]; then
  423.     ln -sr $curdir/slitaz-rootfs$prefix/usr/share/boot $curdir/slitaz-rootfs$prefix/usr/share/syslinux
  424.  
  425.     for file1 in grldr.lzma grub.exe.lzma memdisk.lzma pxelinux.0.lzma
  426.     do
  427.      cp -f $curdir/slitaz-rootfs$prefix/usr/share/boot/$file1 $curdir/slitaz-rootfs$prefix/usr/share/boot/$file1.bak
  428.      unlzma $curdir/slitaz-rootfs$prefix/usr/share/boot/$file1
  429.      mv -f $curdir/slitaz-rootfs$prefix/usr/share/boot/$file1.bak $curdir/slitaz-rootfs$prefix/usr/share/boot/$file1
  430.     done
  431. fi
  432.  
  433.  
  434.  
  435.  
  436. ln -rs $curdir/slitaz-rootfs$prefix/usr/bin/notify-send $curdir/slitaz-rootfs$prefix/usr/bin/notify
  437.  
  438. if [ ! -z $prefix ]; then #if $prefix is null then the target and build environment are the same.
  439.   select_copy_tazpkg_in_target_env
  440.   if [ $cpytaz_target -eq 1 ]; then
  441.       cp --remove-destination -arf $curdir/tazpup-core-files/tazpkg/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  442.   fi
  443.   #I think these two scripts are custom and might be useful for the build system (to re-evaluate (s243a)
  444.   cp -f $curdir/tazpup-core-files/slitaz/usr/bin/tazpet $curdir/slitaz-rootfs$prefix/usr/bin/tazpet
  445.   cp -f $curdir/tazpup-core-files/slitaz/usr/bin/tazpet-box $curdir/slitaz-rootfs$prefix/usr/bin/tazpet-box  
  446. fi
  447.  
  448. #for aWoofCE_pkg in ; do
  449. #  
  450. #done
  451.  
  452.  
  453. #for fullcmd in mount umount ps
  454. #do
  455. #   if [ "$fullcmd" == "ps" ]; then
  456. #    cp -f $curdir/slitaz-rootfs$prefix/bin/ps $curdir/slitaz-rootfs$prefix/bin/ps-FULL
  457. #   elif [ -f $curdir/slitaz-rootfs$prefix/bin/$fullcmd ]; then
  458. #    ln -rs $curdir/slitaz-rootfs$prefix/bin/$fullcmd $curdir/slitaz-rootfs$prefix/bin/$fullcmd-FULL
  459. #   fi
  460. #done
  461. for fullcmd in mount umount ps
  462. do    
  463.      cp -f $curdir/tazpup-core-files/build/no-arch/bin/$fullcmd $curdir/slitaz-rootfs$prefix/bin/$fullcmd
  464.      #cp -f $curdir/tazpup-core-files/build/amd64/bin/$fullcmd-FULL $curdir/slitaz-rootfs$prefix/bin/$fullcmd-FULL #This is redundant with the line below
  465. done
  466. #
  467. cp --no-clobber rf $curdir/tazpup-core-files/build/no-arch/skel/* $curdir/slitaz-rootfs$prefix/etc/skel
  468. cp -f $curdir/tazpup-core-files/build/no-arch/skel/.xinitrc $curdir/slitaz-rootfs$prefix/etc/skel/.xinitrc
  469. cp --remove-destination rf $curdir/tazpup-core-files/build/no-arch/skel/* $curdir/slitaz-rootfs$prefix/etc/skel
  470.  
  471. cp --remove-destination -arf $curdir/tazpup-core-files/build/amd64/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  472.  
  473. #TODO seperate specific applications from /usr/local/aps (so that broken apps don't show up)
  474. cp --no-clobber -arf $curdir/tazpup-core-files/desktop/jwm/no-arch/rootfs-skeleton/slacko6.9.9/* $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  475.  
  476. if [ ! -z $prefix ]; then
  477.   umount -l $curdir/slitaz-rootfs/dev 2>/dev/null
  478.   umount -l $curdir/slitaz-rootfs/sys  
  479.   umount -l $curdir/slitaz-rootfs/proc 
  480.  
  481.   mount -o rbind /proc $curdir/slitaz-rootfs$prefix/proc #We might want to do these minds earlier
  482.   mount -t sysfs none $curdir/slitaz-rootfs$prefix/sys
  483.   if [ $xinteractive -eq 1 ]; then
  484.     echo "Removing block device files..."
  485.     rm -rf $curdir/slitaz-rootfs$prefix/dev/* #Maybe we want to rename rather than delete these
  486.     #mount bind -t devtmpfs none $curdir/slitaz-rootfs/dev
  487.     mount -o rbind /dev $curdir/slitaz-rootfs$prefix/dev
  488.     cp -f /etc/resolv.conf $curdir/slitaz-rootfs$prefix/etc/resolv.conf
  489.   fi
  490. fi
  491. set x-
  492.  
  493. #chroot "$curdir/slitaz-rootfs$prefix/" /usr/bin/gtk-update-icon-cache --ignore-theme-index /usr/share/lxpanel/images
  494.  
  495. if [ ! -z "$users" ]; then #TODO maybe add a menu option if users is not defined.
  496.   chroot "$curdir/slitaz-rootfs$prefix/" /usr/bin/add_users $users
  497. fi
  498. for pkg_dir_rel in pkgs/desktop/rox/next64 pkgs/desktop/tint2/next64 pkgs/desktop/jwm/next64; do
  499.     pkg_dir="$curdir/$pkg_dir_rel"
  500.     for aPkg in `ls -1 $pkg_dir`; do # $pkgs/slitaz-base pkgs/slitaz-dependencies pkgs/slitaz-packages pkgs/slitaz-preinst-pkg; do
  501.        cp --remove-destination -arf $pkg_dir/$aPkg $curdir/slitaz-rootfs$prefix/pkgs/ #2>/dev/null
  502.     done
  503.     for aPkg in `ls -1 $pkg_dir`; do
  504.       install_pkg $pkg_dir/$aPkg
  505.       post_inst_fixes $aPkg
  506.     done
  507. done
  508. if [ $install_WM_jwm -eq 1 ]; then #TODO verify whether or not we should do this before or after adding users
  509.   #source source $curdir/build-scripts/add_puppy_jwm_files.sh
  510.   source $curdir/build-scripts/add_puppy_jwm_files.sh
  511. fi
  512.  
  513. #Im not sure how this impact pcmanfm
  514. $curdir/build-scripts/util/clean_desktop_files.sh
  515.  
  516. for app_type in browsers chat connect package_managers spreadsheets; do
  517.    
  518.     for app_item in "TO_INSTALL_"$app_type; do
  519.       default_ap_Path=$curdir/tazpup-core-files/desktop/defaults/apps/$app_type/$app_item/fs
  520.       if [ -f "$default_ap_Path" ]; then
  521.         cp --remove-destination -arf $default_ap_Path/* \
  522.                  $curdir/slitaz-rootfs$prefix/ 2>/dev/null
  523.                  
  524.         if [ -f "$default_ap_Path/../pinst.sh" ]; then
  525.           cp --remove-destination "$default_ap_Path/../pinst.sh" "$curdir/slitaz-rootfs$prefix/pinst.sh"
  526.           chroot "$curdir/slitaz-rootfs$prefix/" /pinstall.sh
  527.           mv  "$curdir/slitaz-rootfs$prefix/pinst.sh" "default$app_type"'_'"$app_item"'_pinst.sh'
  528.         fi
  529.         break
  530.       fi
  531.     done
  532. done
  533. set x+
  534. update_system_databases
  535. #exit
  536. #if [ cpy_lxde_pofile_info -eq 1 ]; then  
  537. #  $curdir/slitaz-rootfs$prefix/etc/*
  538. #fi
  539.  
  540. #cp $curdir/slitaz-rootfs$prefix/etc/xdg/lxsession $curdir/slitaz-rootfs/$usr_home/.config/lxsession #Shouldn't be necessary
  541. #cp $curdir/slitaz-rootfs$prefix/etc/xdg/lxpanel ~/.config/lxpanel #Shouldn't be necessary
  542. #cp $curdir/slitaz-rootfs$prefix/etc/xdg/templates ~/Templates #Shouldn't be necessary
  543. #update_system_databases
  544. chroot "$curdir/slitaz-rootfs$prefix/" fixmenus
  545.  
  546. sed -i -e "s#"\
  547. "<icon x=\"288\" y=\"32\" label=\"setup\">\/usr\/sbin\/wizardwizard<\/icon>##g" \
  548. /root/Choices/ROX-Filer/globicons
  549.  
  550. sed -i -e "s#"\
  551. "<icon x=\"32\" y=\"416\" label=\"connect\">\/usr\/local\/apps\/Connect<\/icon>#"\
  552. "<icon x="32" y="416" label="connect">/usr/local/bin/defaultconnect</icon>#g" \
  553. /root/Choices/ROX-Filer/PuppyPin
  554.  
  555. sed -i -e "s#"\
  556. "<icon x=\"224\" y=\"32\" label=\"install\">\/usr\/sbin\/dotpup<\/icon>#"\
  557. "<icon x=\"224\" y=\"32\" label=\"install\">\/usr\/local\/bin\/default_packagemanager<\/icon>#g" \
  558. /root/Choices/ROX-Filer/PuppyPin
  559.  
  560. if [ -e $curdir/slitaz-rootfs$prefix/usr/sbin/iconvconfig ]; then
  561.  chroot "$curdir/slitaz-rootfs$prefix/" /usr/sbin/iconvconfig
  562. fi
  563.  
  564. #This is required for udiskd during shutdown. TODO recompile udiskd against libjson-c.so.4
  565. cd $curdir$prefix/usr/lib
  566. ln -s libjson-c.so libjson-c.so.2
  567.  
  568. umount -l $curdir/slitaz-rootfs/dev 2>/dev/null
  569. umount -l $curdir/slitaz-rootfs/sys
  570. umount -l $curdir/slitaz-rootfs/proc   
  571. if [ ! -z $prefix ]; then
  572.   umount -l $curdir/slitaz-rootfs$prefix/dev 2>/dev/null
  573.   umount -l $curdir/slitaz-rootfs$prefix/sys   
  574.   umount -l $curdir/slitaz-rootfs$prefix/proc
  575. fi
  576. #exit
  577.  
  578. extract_kernal_modules
  579.  
  580. echo "Kernal Modlues extracted. Ready to make ISO"
  581. read -p "Press enter to continue" #added by s243a
  582.  
  583. ls -1 $curdir/slitaz-rootfs/pkgs > $curdir/un_used_pkgs.txt
  584. rm  $curdir/slitaz-rootfs/pkgs
  585.  
  586.  
  587. if [ ! "$(ls -A $curdir/slitaz-rootfs/dev)" ]; then
  588.   mv $curdir/slitaz-rootfs/dev-back $curdir/slitaz-rootfs/dev
  589. else  
  590.   rm -rf $curdir/slitaz-rootfs/dev-back
  591. fi
  592. #restore_dev_files
  593.  
  594.  
  595. . $curdir/make_ISO_Fm_slitaz-rootfs #We're sourcing this because it is simpler than exporting all the variables.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement