This commit is contained in:
Rui Lopes
2016-10-16 22:16:45 +01:00
commit afbf7b1218
6 changed files with 680 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.vagrant/
*.iso

35
README.md Normal file
View File

@@ -0,0 +1,35 @@
This is a [Vagrant](https://www.vagrantup.com/) Environment for creating custom [Debian Live](https://www.debian.org/CD/live/) ISO images.
# Usage
Run `vagrant up builder` to launch the debian live builder. This will build the ISO image and copy it to the current directory as `live-image-amd64.hybrid.iso`.
Run `create_empty_box.sh` to create the `empty` environment (the target machine uses it as a base box).
Run `vagrant up target` to launch the `target` machine. Note that vagrant wont be able to connect to it; the ideia is just to use it to test the generated ISO.
# Burning the ISO file to a USB pen/disk drive
Use [Etcher](https://www.etcher.io/) to burn the generated `live-image-amd64.hybrid.iso` file to a device (e.g. `sdd`), or use the following commands:
```bash
sudo su -l # enter a root shell
dd if=live-image-amd64.hybrid.iso of=/dev/sdd bs=128k
sync
echo 1 >/sys/block/sdd/device/rescan
fdisk -u -l /dev/sdd
lsblk /dev/sdd
mkdir -p /mnt/sdd1
mount /dev/sdd1 /mnt/sdd1
(cd /mnt/sdd1 && md5sum --quiet --check md5sum.txt)
umount /mnt/sdd1
eject /dev/sdd
```
# Reference
* [Live Systems Manual](http://debian-live.alioth.debian.org/live-manual/stable/manual/html/live-manual.en.html)
* [Debian Live Developer Information](http://debian-live.alioth.debian.org/)
* [Debian Live Wiki](http://wiki.debian.org/DebianLive): Information about the Debian Live team and its contacts.

26
Vagrantfile vendored Normal file
View File

@@ -0,0 +1,26 @@
Vagrant.configure('2') do |config|
config.vm.provider :virtualbox do |vb|
vb.linked_clone = true
vb.memory = 2048
vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
end
config.vm.define :builder do |config|
config.vm.box = 'ubuntu-16.04-amd64'
config.vm.hostname = 'builder'
config.vm.provision :shell, path: 'builder.sh'
end
config.vm.define :target do |config|
config.vm.box = 'empty'
config.vm.provider :virtualbox do |vb|
vb.customize ['storageattach', :id,
'--storagectl', 'IDE Controller',
'--device', '0',
'--port', '1',
'--type', 'dvddrive',
'--tempeject', 'on',
'--medium', 'live-image-amd64.hybrid.iso']
end
end
end

318
bootloader-splash.svg Normal file
View File

@@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="640"
height="480"
id="bootloader-splash"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="bootloader-splash.svg">
<defs
id="defs3322">
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.402663,0,0,1.115648,-6.237984,0.0533075)"
r="18.370251"
fy="10.943316"
fx="15.491823"
cy="10.943316"
cx="15.491823"
id="radialGradient2813"
xlink:href="#linearGradient2807"
inkscape:collect="always" />
<radialGradient
r="35.934704"
fy="424.15677"
fx="131.23691"
cy="424.15677"
cx="131.23691"
gradientTransform="matrix(0.101953,-0.04272301,0.09621296,0.229599,-48.67227,-64.24148)"
gradientUnits="userSpaceOnUse"
id="radialGradient2798"
xlink:href="#linearGradient8543"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.415385,0,26.70146)"
r="30.365856"
fy="45.673546"
fx="29.898689"
cy="45.673546"
cx="29.898689"
id="radialGradient18290"
xlink:href="#linearGradient18284"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.105628,-0.04514018,0.06692574,0.156607,-46.01605,-24.35485)"
r="103.26014"
fy="409.83737"
fx="340.35886"
cy="409.83737"
cx="340.35886"
id="radialGradient13895"
xlink:href="#linearGradient8543"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.08174351,0.01024998,-0.04335971,0.345793,6.123413,-84.50421)"
r="38.451698"
fy="270.67969"
fx="424.99243"
cy="270.67969"
cx="424.99243"
id="radialGradient11208"
xlink:href="#linearGradient11202"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.272962,-0.071724,0.05616202,0.213737,-78.54657,-24.30491)"
r="48.782982"
fy="243.06874"
fx="293.81989"
cy="243.06874"
cx="293.81989"
id="radialGradient10317"
xlink:href="#linearGradient8543"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.224796,0.01017229,-0.00975947,0.215674,-73.87964,-54.89804)"
r="40.975471"
fy="286.46918"
fx="500.97794"
cy="286.46918"
cx="500.97794"
id="radialGradient9434"
xlink:href="#linearGradient8543"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.163532,-0.01065754,0.01078108,0.165425,-46.18187,-65.65506)"
r="235.88632"
fy="685.99139"
fx="420.87839"
cy="685.99139"
cx="420.87839"
id="radialGradient8549"
xlink:href="#linearGradient8543"
inkscape:collect="always" />
<radialGradient
r="297.21338"
fy="-72.420044"
fx="336.73767"
cy="-72.420044"
cx="336.73767"
gradientTransform="matrix(0.136507,0,-4.484926e-5,0.07137743,-23.39816,12.31028)"
gradientUnits="userSpaceOnUse"
id="radialGradient7666"
xlink:href="#linearGradient5012"
inkscape:collect="always" />
<linearGradient
id="linearGradient5012">
<stop
id="stop5014"
offset="0"
style="stop-color:#fdf188;stop-opacity:1;" />
<stop
id="stop5016"
offset="1"
style="stop-color:#d3bc00;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient8543">
<stop
id="stop8545"
offset="0"
style="stop-color:#fffef5;stop-opacity:0.94117647;" />
<stop
id="stop8547"
offset="1"
style="stop-color:#fce94f;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient11202">
<stop
id="stop11204"
offset="0"
style="stop-color:#c4a000;stop-opacity:1;" />
<stop
id="stop11206"
offset="1"
style="stop-color:#c4a000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient18284">
<stop
id="stop18286"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0.5"
id="stop20913" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop19165" />
</linearGradient>
<linearGradient
id="linearGradient2807"
inkscape:collect="always">
<stop
id="stop2809"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop2811"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.775"
inkscape:cx="151.78668"
inkscape:cy="250.84337"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1026"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata3325">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-572.3622)">
<rect
style="fill:#000000;fill-opacity:1;stroke:none"
id="bg"
width="640"
height="480"
x="0"
y="572.36218" />
<text
transform="scale(1.0000015,0.9999985)"
sodipodi:linespacing="100%"
id="title"
y="762.93573"
x="253.40782"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:35.65467453px;line-height:100%;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="762.93573"
x="253.40782"
sodipodi:role="line"
style="font-style:normal;font-weight:bold;font-size:19.99996948px;-inkscape-font-specification:'DejaVu Sans Bold'"
id="tspan3045">Debian Live</tspan></text>
<g
id="hat"
transform="matrix(2.8369273,0,0,2.8369235,251.78292,602.43406)">
<ellipse
transform="matrix(0.742527,0,-0.05812964,1.428611,4.500517,-36.68345)"
id="path17409"
style="fill:url(#radialGradient18290);fill-opacity:1;stroke:none"
cx="29.898689"
cy="45.673546"
rx="30.365856"
ry="12.613509" />
<path
sodipodi:nodetypes="cccscsssscsccsc"
id="path3120"
d="M 23.152758,1.1801876 C 20.380218,1.2190783 17.86582,1.8908769 15.634281,3.0196314 14.541531,5.1714614 10.9437,7.7293655 9.4689484,8.0015561 6.5691703,11.460832 4.6887193,15.805035 3.9754523,19.98162 c -4.375e-4,0.0026 4.366e-4,0.0052 0,0.0077 -1.1863594,1.549717 -1.6900108,3.396594 -1.3773472,5.53256 1.1211744,7.659314 3.2821678,14.888292 8.1850959,16.556275 7.154429,2.433946 21.871769,1.785847 25.129507,0.458258 7.13903,-2.909286 7.771453,-9.285098 8.891432,-16.780256 0.305554,-2.044832 -0.144835,-3.841202 -1.230601,-5.372942 -0.009,-0.0556 -0.01849,-0.111474 -0.02832,-0.167342 C 42.763966,15.777007 40.697859,11.326849 37.602582,7.8466935 35.508773,7.62926 31.462964,4.270333 30.483158,2.6229925 28.330506,1.7020155 25.961342,1.1801876 23.407632,1.1801876 c -0.08532,0 -0.170037,-0.00119 -0.254874,0 z"
style="fill:url(#radialGradient7666);fill-opacity:1;stroke:#c4a000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccscc"
id="path7668"
d="M 43.629688,22.792984 C 39.033494,39.233217 10.438199,40.802737 3.7832765,23.04227 3.7410682,39.366403 10.103414,44.083889 28.189955,43.247454 c 3.061977,-0.140689 10.00982,0.04287 14.614484,-9.136776 2.238365,-11.5104 0.825249,-11.317694 0.825249,-11.317694 z"
style="opacity:0.66666667;fill:url(#radialGradient8549);fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccc"
id="path8553"
d="m 34.691565,7.6783057 2.500881,1.1253976 c 0,0 -1.310404,10.1226397 -6.669016,16.4849717 1.771665,-6.455834 4.188975,-17.6103693 4.168135,-17.6103693 z"
style="fill:url(#radialGradient9434);fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccc"
id="path9436"
d="m 15.872437,4.1562328 c 1.50053,9.0656942 6.50229,19.4860282 6.002115,20.0070452 -4.584948,-6.981624 -6.502291,-12.921217 -8.00282,-17.9229779 0,-0.083363 2.000705,-2.0632267 2.000705,-2.0840673 z"
style="fill:url(#radialGradient10317);fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccsc"
id="path10319"
d="M 30.21082,3.8227818 C 26.126047,20.328594 25.959322,23.079563 25.959322,23.079563 c 0,0 6.335566,-16.7559003 6.335566,-17.1727135 0,-8e-7 -1.583891,-1.5005286 -2.084068,-2.0840677 z"
style="fill:url(#radialGradient11208);fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<flowRoot
id="flowRoot12974"
xml:space="preserve"><flowRegion
id="flowRegion12976"><rect
y="412.80496"
x="86.787514"
height="16.02231"
width="40.055775"
id="rect12978" /></flowRegion><flowPara
id="flowPara12980" /></flowRoot> <path
sodipodi:nodetypes="ccccccc"
id="path13014"
d="m 16.18209,34.476182 -0.04467,-9.569745 14.493727,0 1.642604,-1.263542 -16.931465,0 0.04467,10.640581 0.795134,0.192706 z"
style="fill:url(#radialGradient13895);fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccc"
id="path13897"
d="m 31.043495,24.81709 0.08168,9.804611 0.686144,-0.214742 0.01198,-10.85341 -0.779803,1.263541 z"
style="fill:#958401;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccscc"
id="path16526"
d="m 4.2551267,24.106065 c 0,0 2.3166503,8.115689 10.2209413,8.766037 1.105608,2.490418 -1.13497,4.124601 -1.13497,4.124601 L 9.7315781,36.745641 c 0,0 -6.2387745,-7.992942 -6.4882087,-9.900882 -0.2494325,-1.907937 0.1632835,-3.407793 0.1632835,-3.407793 l 0.8484738,0.669099 z"
style="fill:url(#radialGradient2798);fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
style="opacity:0.74444442;fill:none;stroke:#ffffff;stroke-width:0.99999976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 23.184204,2.3889904 C 20.570275,2.4256563 18.199721,3.0590226 16.095844,4.1232033 15.065608,6.1519314 11.673602,8.563503 10.283218,8.8201221 7.5493302,12.0815 5.776456,16.17718 5.1039936,20.11483 c -4.124e-4,0.0024 4.116e-4,0.0049 0,0.0073 -1.1184901,1.46106 -1.8584936,3.246475 -1.5637169,5.260247 1.0570343,7.22114 2.9276025,13.709677 7.3279793,15.639454 5.923141,2.597582 21.539722,1.785935 24.611092,0.534295 6.73062,-2.742852 7.061699,-8.930694 8.117606,-15.997069 0.288074,-1.927851 -0.13655,-3.621454 -1.160201,-5.065566 -0.0084,-0.05242 -0.01743,-0.105097 -0.0267,-0.157769 C 41.673494,16.150755 39.725585,11.955182 36.807382,8.6741189 34.833356,8.4691243 31.019,5.3023548 30.095246,3.7492553 28.065743,2.8809656 25.832115,2.3889904 23.424497,2.3889904 c -0.08044,0 -0.160309,-0.00112 -0.240293,0 z"
id="path2703"
sodipodi:nodetypes="cccscsssscsccsc"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccssccscccssc"
id="path2800"
d="m 22.59375,2.78125 c -2.329557,0.1165682 -4.440971,0.7250384 -6.34375,1.6875 -1.010725,1.9903059 -4.354698,4.373241 -5.71875,4.625 -2.6821095,3.199611 -4.4027734,7.199424 -5.0625,11.0625 -4.046e-4,0.0024 4.038e-4,0.02888 0,0.03125 -1.0973069,1.43339 -1.4580267,3.591148 -1.4580267,3.591148 4.685267,3.605062 7.6416117,0.213892 14.3188727,-2.01722 12.59928,1.923141 18.748338,-0.995945 22.514154,-5.667678 0.0069,-0.0085 -0.0035,-0.02088 0,-0.03125 C 39.852567,13.479666 38.411479,11.016387 36.5625,8.9375 34.62586,8.7363873 30.875008,5.6486852 29.96875,4.125 27.977684,3.2731547 25.79952,2.78125 23.4375,2.78125 c -0.07892,10e-8 -0.171531,-0.0011 -0.25,0 -0.200346,0.00281 -0.39633,-0.00988 -0.59375,0 z"
style="opacity:0.59444424;fill:url(#radialGradient2813);fill-opacity:1;stroke:none"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

273
builder.sh Normal file
View File

@@ -0,0 +1,273 @@
#!/bin/bash
set -eux
echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >/etc/sudoers.d/env_keep_apt
chmod 440 /etc/sudoers.d/env_keep_apt
export DEBIAN_FRONTEND=noninteractive
apt-get update
#
# provision vim.
apt-get install -y --no-install-recommends vim
cat >~/.vimrc <<'EOF'
syntax on
set background=dark
set esckeys
set ruler
set laststatus=2
set nobackup
EOF
#
# provision git.
apt-get install -y --no-install-recommends git
git config --global user.name 'Rui Lopes'
git config --global user.email 'rgl@ruilopes.com'
git config --global push.default simple
#
# enable wget quiet mode (to disable the process bar).
echo 'quiet=on' >~/.wgetrc
#
# configure the shell.
cat >~/.bash_history <<'EOF'
EOF
cat >~/.bashrc <<'EOF'
# If not running interactively, don't do anything
[[ "$-" != *i* ]] && return
export EDITOR=vim
export PAGER=less
alias l='ls -lF --color'
alias ll='l -a'
alias h='history 25'
alias j='jobs -l'
EOF
cat >~/.inputrc <<'EOF'
"\e[A": history-search-backward
"\e[B": history-search-forward
"\eOD": backward-word
"\eOC": forward-word
set show-all-if-ambiguous on
set completion-ignore-case on
EOF
#
# install dependencies.
apt-get install -y dpkg-dev debhelper debootstrap debian-archive-keyring
apt-get install -y libcdio-utils librsvg2-bin pngquant
#
# build and install the debian live-build package from source.
su vagrant <<'VAGRANT'
set -eux
# enable wget quiet mode (to disable the process bar).
echo 'quiet=on' >~/.wgetrc
# clone the live-build repo.
cd ~
git clone git://anonscm.debian.org/git/debian-live/live-build.git
cd live-build
git checkout 6e0b98ce05c1a8e8dd140009cc60c7ea348b6fa1
git rev-parse --abbrev-ref HEAD # branch
git rev-parse HEAD # revision
# build the package.
dpkg-buildpackage -b -uc -us
VAGRANT
# install the live-build package.
dpkg -i /home/vagrant/live-build_*.deb
#
# build the Debian Standard live image (from the debian branch).
# see lb_config(1)
# NB default images configurations are defined in a branch at https://anonscm.debian.org/git/debian-live/live-images.git/
# e.g. https://anonscm.debian.org/git/debian-live/live-images.git/tree/images/standard?h=debian
# NB by default we do not build this, this is here as an example on how to build the standard image.
if false; then
mkdir live-images && pushd live-images
lb config --config git://anonscm.debian.org/git/debian-live/live-images.git::debian
cd images/standard
# always disable the creation of the source tarball (e.g. live-image-source.debian.tar)
# because it takes a bit of time to complete and we do not really use it.
sed -i -E 's,(\s*--source ).*,\1false \\,' auto/config
lb config
lb build
popd
fi
#
# build a custom live image.
mkdir custom-image && pushd custom-image
# configure it.
# see http://debian-live.alioth.debian.org/live-manual/stable/manual/html/live-manual.en.html
# see lb(1)
# see live-build(7)
# see lb_config(1)
# NB default images configurations are defined in a branch at https://anonscm.debian.org/git/debian-live/live-images.git/
# e.g. https://anonscm.debian.org/git/debian-live/live-images.git/tree/images/standard?h=debian
mkdir -p auto
cp /usr/share/doc/live-build/examples/auto/* auto/
cat >auto/config <<'EOF'
#!/bin/sh
set -eux
lb config noauto \
--binary-images iso-hybrid \
--mode debian \
--distribution stretch \
--architectures amd64 \
--bootappend-live 'boot=live components' \
--mirror-bootstrap http://ftp.pt.debian.org/debian/ \
--mirror-binary http://ftp.pt.debian.org/debian/ \
--apt-indices false \
--memtest none \
"${@}"
EOF
# NB --bootappend-live '... keyboard-layouts=pt' is currently broken. we have to manually configure the keyboard.
# see Re: Status of kbd console-data and console-setup at https://lists.debian.org/debian-devel/2016/08/msg00276.html
chmod +x auto/config
mkdir -p config/package-lists
cat >config/package-lists/custom.list.chroot <<'EOF'
console-data
debconf-utils
less
vim
tcpdump
qemu-utils
ntfs-3g
EOF
mkdir -p config/preseed
cat >config/preseed/keyboard.cfg.chroot <<'EOF'
# format: <owner> <question name> <question type> <value>
# NB put just a single space or tab between <question type> and <value>.
# NB this will be eventually stored at /var/cache/debconf/config.dat
console-common console-data/keymap/policy select Select keymap from full list
console-common console-data/keymap/full select pt-latin1
EOF
mkdir -p config/includes.chroot/lib/live/config
cat >config/includes.chroot/lib/live/config/0149-keyboard <<'EOF'
#!/bin/sh
set -eux
dpkg-reconfigure console-common
EOF
chmod +x config/includes.chroot/lib/live/config/0149-keyboard
mkdir -p config/includes.chroot/etc
cat >config/includes.chroot/etc/motd <<'EOF'
Enter a root shell with:
sudo su -l
Change the keyboard layout with one of:
sudo loadkeys pt-latin1
sudo loadkeys us
EOF
mkdir -p config/includes.chroot/etc/profile.d
cat >config/includes.chroot/etc/profile.d/login.sh <<'EOF'
[[ "$-" != *i* ]] && return
export EDITOR=vim
export PAGER=less
alias l='ls -lF --color'
alias ll='l -a'
alias h='history 25'
alias j='jobs -l'
EOF
cat >config/includes.chroot/etc/inputrc <<'EOF'
set input-meta on
set output-meta on
set show-all-if-ambiguous on
set completion-ignore-case on
"\e[A": history-search-backward
"\e[B": history-search-forward
"\eOD": backward-word
"\eOC": forward-word
EOF
mkdir -p config/includes.chroot/etc/vim
cat >config/includes.chroot/etc/vim/vimrc.local <<'EOF'
syntax on
set background=dark
set esckeys
set ruler
set laststatus=2
set nobackup
EOF
mkdir -p config/hooks/normal
cat >config/hooks/normal/9990-bootloader-splash.hook.binary <<'EOF'
#!/bin/sh
set -eux
rsvg-convert --format png --width 640 --height 480 /vagrant/bootloader-splash.svg -o isolinux/splash.png
pngquant --ext .png --force isolinux/splash.png
EOF
cat >config/hooks/normal/9990-bootloader-menu.hook.binary <<'EOF'
#!/bin/sh
set -eux
cat >isolinux/menu.cfg <<'EOM'
menu hshift 0
menu width 82
include stdmenu.cfg
include live.cfg
menu clear
EOM
EOF
chmod +x config/hooks/normal/*.hook.*
# build it.
lb build
# show some information about the generated iso file.
fdisk -l live-image-amd64.hybrid.iso
iso-info live-image-amd64.hybrid.iso --no-header
#iso-info live-image-amd64.hybrid.iso --no-header -f | sed '0,/ISO-9660 Information/d' | sort -k 2
# copy it on the host fs (it will be used by the target VM).
cp live-image-amd64.hybrid.iso /vagrant
# clean it.
lb clean
#lb clean --purge
# add it to local git repository.
git init
cp /usr/share/doc/live-build/examples/gitignore .gitignore
echo 'chroot.files' >>.gitignore
echo 'live-image-*' >>.gitignore
git add .
git commit -m 'Init.'
popd

26
create_empty_box.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
set -eux
[ -d ~/.vagrant.d/boxes/empty ] && exit 0
rm -rf tmp-empty-box
mkdir -p tmp-empty-box
pushd tmp-empty-box
TEMPLATE_BOX=~/.vagrant.d/boxes/ubuntu-16.04-amd64/0/virtualbox
echo '{"provider":"virtualbox"}' >metadata.json
VBoxManage createhd --filename empty.vmdk --format VMDK --size 10000
sed -r \
-e 's,packer-amd64-virtualbox-.+?.vmdk,empty.vmdk,' \
-e 's,([">]packer-amd64-virtualbox-)[^"<]+?,\1empty,' \
$TEMPLATE_BOX/box.ovf \
>box.ovf
cp $TEMPLATE_BOX/Vagrantfile .
tar cvzf empty.box metadata.json Vagrantfile box.ovf empty.vmdk
VBoxManage closemedium empty.vmdk --delete
vagrant box add empty empty.box
popd
rm -rf tmp-empty-box