Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.32 KB | None | 0 0
  1. bkm@optiplex:~/src/live-sdk/blends/jessie-oblx$ cat config
  2. #!/usr/bin/env zsh
  3. # config for jessie-oblx.blend
  4.  
  5. vars+=(username userpass default_shell)
  6. arrs+=(custom_deb_packages)
  7.  
  8. blend_name="jessie-oblx"
  9. blend_vers="1.0"
  10. os="$blend_name"
  11.  
  12. image_name="${blend_name}-${blend_vers}-${arch}"
  13.  
  14. # Uncomment to keep a separate bootstrap tarball for each blend.
  15. os="$blend_name"
  16.  
  17. # Uncomment and change to ascii at your own risk.
  18. release="jessie"
  19.  
  20.  
  21. username="user"
  22. userpass="user"
  23. default_shell="/bin/bash"
  24. rootcredentials="root:root"
  25.  
  26.  
  27. # uncomment to create uefi-bootable iso
  28. #mkefi="yes"
  29. #efi_work="$BLENDPATH/efi-files"
  30.  
  31. # grubversion doesn't matter for booting the live iso.
  32. # Use the version of grub that you want to install to hard drive,
  33. # or have grub deb packages available inside the live system.
  34. #grubversion="grub-pc"
  35. #grubversion="grub-efi-amd64"
  36. grubversion="grub-pc"
  37.  
  38. ##### To exclude recommends: lines 101 and 161 in zlibs/bootstrap.
  39.  
  40.  
  41. base_packages+=(
  42.  
  43. bash-completion
  44. texinfo
  45. acpi-support-base
  46. aptitude
  47. apt-listchanges
  48. discover
  49. dnsutils
  50. doc-debian
  51. docutils-common
  52. docutils-doc
  53. ftp
  54. gettext
  55. gnupg2
  56. $grubversion
  57. laptop-detect
  58. lsof
  59. mlocate
  60. mutt
  61. ncurses-term
  62. nfs-common
  63. procmail
  64. reportbug
  65. telnet
  66. usbutils
  67. w3m
  68. whois
  69. )
  70.  
  71.  
  72. extra_packages+=(
  73.  
  74. sshfs
  75. mbr
  76. w3m
  77. hwinfo
  78. moc
  79. libav-tools
  80. ntfs-3g
  81. dosfstools
  82. live-config
  83. live-config-sysvinit
  84. squashfs-tools
  85. xorriso
  86. pmount
  87. pv
  88. rsync
  89. syslinux
  90. syslinux-common
  91. isolinux
  92. gdisk
  93. irssi
  94. scrot
  95. feh
  96. p7zip-full
  97. pm-utils
  98. sysv-rc-conf
  99. tree
  100. file
  101. live-boot-doc
  102. live-config-doc
  103. dkms
  104. eject
  105. openssh-blacklist
  106. xorg
  107. xserver-xorg
  108. xinit
  109. xserver-xorg-video-all
  110. xterm
  111. openbox
  112. openbox-menu
  113. obconf
  114. lxappearance
  115. lxappearance-obconf
  116. lxpanel
  117. lxterminal
  118. lxrandr
  119. spacefm
  120. xarchiver
  121. libnotify-bin
  122. mesa-utils
  123. gparted
  124. leafpad
  125. firejail
  126. wicd
  127. xscreensaver
  128. xserver-xorg-video-all
  129. x11vnc
  130. xtightvncviewer
  131. )
  132.  
  133.  
  134. # Replace the default purge_packages list if you want to keep dbus.
  135. # or add any packages you want to purge.
  136. #
  137. # purge_packages=()
  138.  
  139. purge_packages=(
  140. libsystemd0
  141. )
  142.  
  143.  
  144.  
  145. # i386
  146. #custom_deb_packages+=(yad_0.27.0-1_i386.deb palemoon_27.2.0~repack-1_i386.deb)
  147.  
  148. # amd64
  149. custom_deb_packages+=(yad_0.27.0-1_amd64.deb palemoon_27.2.0~repack-1_amd64.deb)
  150.  
  151.  
  152.  
  153. custom_deb_packages+=(
  154. firemenu-1.2.deb
  155. refracta2usb-2.3.6.deb
  156. refractainstaller-base_9.2.1_all.deb
  157. refractainstaller-gui_9.2.2_all.deb
  158. refractasnapshot-base_10.0.2_all.deb
  159. refractasnapshot-gui_10.0.2_all.deb
  160. usbpmount-1.2+blend.deb
  161. )
  162.  
  163.  
  164.  
  165. bkm@optiplex:~/src/live-sdk/blends/jessie-oblx$ cat jessie-oblx.blend
  166. #!/usr/bin/env zsh
  167. # jessie-oblx.blend
  168.  
  169. BLENDPATH="${BLENDPATH:-$(dirname $0)}"
  170.  
  171. source $BLENDPATH/config
  172.  
  173. blend_preinst() {
  174. fn blend_preinst
  175. req=(strapdir blend)
  176. ckreq || return 1
  177.  
  178. notice "executing $blend_name preinst"
  179.  
  180. add-user "$username" "$userpass"
  181.  
  182. notice "copying blend-specific debs"
  183. cp -fv "$BLENDPATH"/*.deb "$R/extra/custom-packages"
  184.  
  185. }
  186.  
  187.  
  188. blend_postinst() {
  189. fn blend_postinst
  190. req=(strapdir)
  191. ckreq || return 1
  192.  
  193. notice "executing $blend_name postinst"
  194.  
  195. if [[ $mkefi = yes ]] ; then
  196. iso_make_efi
  197. fi
  198.  
  199. install-custdebs || zerr
  200. pushd "$strapdir"
  201. sudo rsync -avx "$BLENDPATH"/rootfs-overlay/* . || zerr
  202. popd
  203.  
  204. blend_finalize || zerr
  205. }
  206.  
  207.  
  208. iso_setup_isolinux() {
  209. fn iso_setup_isolinux
  210. req=(workdir strapdir)
  211. ckreq || return 1
  212.  
  213. notice "setting up isolinux"
  214.  
  215. pushd $workdir
  216. sudo mkdir -p binary/{live,isolinux}
  217. act "copying kernel and initrd"
  218.  
  219. sudo cp -rav "$BLENDPATH"/isolinux-overlay/* binary/isolinux/
  220. sudo cp $strapdir/boot/vmlinuz* binary/live/vmlinuz
  221. sudo cp $strapdir/boot/initrd* binary/live/initrd
  222.  
  223. # alternate location if live-build is not installed:
  224. # /usr/lib/ISOLINUX/isolinux.bin (or other, for older versions of syslinux)
  225. sudo cp /usr/share/live/build/bootloaders/isolinux/isolinux.bin \
  226. binary/isolinux
  227. sudo cp /usr/share/live/build/bootloaders/isolinux/*.c32 \
  228. binary/isolinux
  229. popd
  230. }
  231.  
  232.  
  233. iso_write_isolinux_cfg() {
  234. fn iso_write_isolinux_cfg "(override)"
  235. req=(workdir arch)
  236. ckreq || return 1
  237.  
  238. notice "writing isolinux configuration"
  239. cat <<EOF | sudo tee ${workdir}/binary/isolinux/isolinux.cfg >/dev/null
  240. ui vesamenu.c32
  241. prompt 0
  242. menu title devuan-live boot menu
  243. timeout 70
  244. menu background /isolinux/splash.png
  245. menu background /isolinux/splash.png
  246. menu color title * #FFFFFFFF *
  247. menu color border * #00000000 #00000000 none
  248. menu color sel * #ffffffff #A1B067 *
  249. menu color hotsel 1;7;37;40 #ffffffff #A1B067 *
  250. menu color tabmsg * #E5FD91 #00000000 *
  251. menu color cmdline 0 #E5FD91 #00000000
  252. menu vshift 12
  253. menu rows 12
  254.  
  255. label live-${arch}
  256. menu label ^jessie-oblx (${arch})
  257. menu default
  258. linux /live/vmlinuz
  259. append initrd=/live/initrd boot=live username=$username
  260.  
  261. label toram
  262. menu label ^jessie-oblx (load to RAM)
  263. linux /live/vmlinuz
  264. append initrd=/live/initrd boot=live username=$username toram
  265.  
  266. label failsafe
  267. menu label ^jessie-oblx (failsafe)
  268. kernel /live/vmlinuz noapic noapm nodma nomce nolapic nosmp vga=normal
  269. append initrd=/live/initrd boot=live
  270.  
  271. endtext
  272. EOF
  273. }
  274.  
  275.  
  276. iso_squash_strap() {
  277. fn iso_squash_strap
  278. req=(workdir strapdir)
  279. ckreq || return 1
  280.  
  281. notice "creating squashfs out of strapdir"
  282.  
  283. pushd $workdir
  284. sudo mksquashfs $strapdir binary/live/filesystem.squashfs -noappend -comp xz -Xbcj x86 || zerr
  285. popd
  286. }
  287.  
  288.  
  289. iso_xorriso_build() {
  290. fn iso_xorriso_build
  291. req=(workdir image_name)
  292. ckreq || return 1
  293.  
  294. notice "building iso..."
  295. isoname="${image_name}-live.iso"
  296.  
  297. mkdir -p $R/dist
  298. pushd $workdir
  299. sudo xorriso -as mkisofs -r -J -joliet-long -l \
  300. -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
  301. -partition_offset 16 \
  302. -A "${os} Live - ${arch}" \
  303. -b isolinux/isolinux.bin \
  304. -c isolinux/boot.cat \
  305. -no-emul-boot \
  306. -boot-load-size 4 \
  307. -boot-info-table \
  308. # -eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \
  309. -o $R/dist/$isoname \
  310. binary || zerr
  311. popd
  312. }
  313.  
  314.  
  315. # create /boot and /efi for uefi.
  316. # uefi code borrowed and adapted from David Hare, who borrowed and adapted it
  317. # from similar scripts by Colin Watson and Patrick J. Volkerding.
  318. iso_make_efi() {
  319. fn iso_make_efi
  320. req=(workdir efi_work)
  321. ckreq || return 1
  322. set -x
  323. notice "creating efi boot files"
  324.  
  325. # uefi_opt="-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
  326.  
  327. tempdir="$(mktemp -d /tmp/work_temp.XXXX)"
  328.  
  329. # for initial grub.cfg
  330. mkdir -p "$tempdir"/boot/grub
  331.  
  332.  
  333. cat >"$tempdir"/boot/grub/grub.cfg <<EOF
  334. search --file --set=root /isolinux/isolinux.cfg
  335. set prefix=(\$root)/boot/grub
  336. source \$prefix/x86_64-efi/grub.cfg
  337. EOF
  338.  
  339.  
  340. if ! [ -d "$efi_work" ] ; then
  341. mkdir "$efi_work"
  342.  
  343. fi
  344.  
  345. pushd "$efi_work"
  346.  
  347. # start with empty directories.
  348.  
  349. if [ -d "boot" ] ; then
  350. rm -rf boot
  351. fi
  352.  
  353. if [ -d "efi" ] ; then
  354. rm -rf efi
  355. fi
  356.  
  357. mkdir -p boot/grub/x86_64-efi
  358. mkdir -p efi/boot
  359.  
  360. # copy splash
  361. cp ${isolinux_overlay}splash.png boot/grub/splash.png
  362.  
  363. # second grub.cfg file
  364. for i in $(ls /usr/lib/grub/x86_64-efi|grep part_|grep \.mod|sed 's/.mod//'); do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg; done
  365. # Additional modules so we don't boot in blind mode. I don't know which ones are really needed.
  366. for i in efi_gop efi_uga ieee1275_fb vbe vga video_bochs video_cirrus jpeg png gfxterm ; do echo "insmod $i" >> boot/grub/x86_64-efi/grub.cfg ; done
  367.  
  368. echo "source /boot/grub/grub.cfg" >> boot/grub/x86_64-efi/grub.cfg
  369.  
  370. pushd "$tempdir"
  371.  
  372. # make a tarred "memdisk" to embed in the grub image
  373. tar -cvf memdisk boot
  374.  
  375. # make the grub image
  376. grub-mkimage -O "x86_64-efi" -m "memdisk" -o "bootx64.efi" -p '(memdisk)/boot/grub' search iso9660 configfile normal memdisk tar cat part_msdos part_gpt fat ext2 ntfs ntfscomp hfsplus chain boot linux
  377.  
  378. popd
  379.  
  380. # copy the grub image to efi/boot (to go later in the device's root)
  381. cp "$tempdir"/bootx64.efi efi/boot
  382.  
  383. #######################
  384.  
  385. ## Do the boot image "boot/grub/efiboot.img"
  386.  
  387. dd if=/dev/zero of=boot/grub/efiboot.img bs=1K count=1440
  388. /sbin/mkdosfs -F 12 boot/grub/efiboot.img
  389.  
  390. sudo mkdir img-mnt
  391.  
  392. sudo mount -o loop boot/grub/efiboot.img img-mnt
  393.  
  394. sudo mkdir -p img-mnt/efi/boot
  395.  
  396. sudo cp "$tempdir"/bootx64.efi img-mnt/efi/boot/
  397.  
  398. #######################
  399.  
  400. # copy modules and font
  401. cp /usr/lib/grub/x86_64-efi/* boot/grub/x86_64-efi/
  402.  
  403. # if this doesn't work try another font from the same place (grub's default, unicode.pf2, is much larger)
  404. # Either of these will work, and they look the same to me. Unicode seems to work with qemu. -fsr
  405. # cp /usr/share/grub/ascii.pf2 boot/grub/font.pf2
  406. cp /usr/share/grub/unicode.pf2 boot/grub/font.pf2
  407.  
  408. # doesn't need to be root-owned
  409. # sudo chown -R 1000:1000 $(pwd) 2>/dev/null
  410.  
  411. # Cleanup efi temps
  412. sudo umount img-mnt
  413. sudo rmdir img-mnt
  414. rm -rf "$tempdir"
  415.  
  416. popd
  417.  
  418.  
  419. # Copy efi files to iso
  420. pushd $workdir
  421. sudo rsync -avx "$efi_work"/boot binary/
  422. sudo rsync -avx "$efi_work"/efi binary/
  423. popd
  424.  
  425. # Do the main grub.cfg (which gets loaded last):
  426. cat <<EOF | sudo tee ${workdir}/binary/boot/grub/grub.cfg
  427. if loadfont $prefix/font.pf2 ; then
  428. set gfxmode=640x480
  429. insmod efi_gop
  430. insmod efi_uga
  431. insmod video_bochs
  432. insmod video_cirrus
  433. insmod gfxterm
  434. insmod jpeg
  435. insmod png
  436. terminal_output gfxterm
  437. fi
  438.  
  439. background_image /boot/grub/splash.png
  440. set menu_color_normal=white/black
  441. set menu_color_highlight=dark-gray/white
  442. set timeout=6
  443.  
  444. menuentry "${os} (defaults)" {
  445. set gfxpayload=keep
  446. linux /live/vmlinuz boot=live username=$username
  447. initrd /live/initrd
  448. }
  449. EOF
  450. set +x
  451. }
  452.  
  453.  
  454. blend_finalize() {
  455. fn blend_finalize
  456. req=(strapdir)
  457. ckreq || return 1
  458.  
  459. cat <<EOF | sudo tee ${strapdir}/finalize >/dev/null
  460. #!/bin/sh
  461. # finalize
  462. set -x
  463. exec 2>finalize.log
  464.  
  465.  
  466. ## perms
  467.  
  468. for i in cdrom floppy audio dip video plugdev netdev ; do # lpadmin scanner # put this in config file?
  469. gpasswd -a "$username" \${i}
  470. done
  471.  
  472. chsh -s "$default_shell" "$username"
  473. cp /etc/skel/.bashrc /home/"$username"
  474. chown -R 1000:1000 /home/"$username"
  475.  
  476.  
  477. # remove fstab for iso. This should probably be in iso_prepare_strap
  478. rm -f /etc/fstab
  479.  
  480.  
  481. ## cleanup
  482.  
  483. #apt-get --yes --force-yes autoremove
  484. apt-get clean
  485. /usr/bin/updatedb
  486. EOF
  487. chroot-script finalize || zerr
  488.  
  489. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement