Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 338 lines (308 sloc) 16.818 kb
4eafa41 Sven-Hendrik Haase Initial commit
authored
1 #!/bin/bash
2
3 # This is a buildscript to build lglive (http://live.linux-gamers.net)
4 # To understand what is going on here, you should read the Arch Linux wiki
5 # article on "Archiso". Basically, this script prepares 2 editions of lglive:
6 # A 'big' edition and a 'lite' edition which both double as a CD/USB image.
7 # This file will need to be called as root because of nature of device files
8 # and my lazyness to handle this properly. As you know, this is dangerous and
9 # I do not advise the inexperienced user to attempt this. However, I'm trying
10 # my best to make the script work as well as possible.
11 # I know it is ugly.
12 #
13 # This script and the rest of the lglive distribution is licensed under
14 # GPLv3.
15 #
16 # If you have questions or feedback just shoot me a mail or ask on IRC.
17 #
18 # Sven-Hendrik 'Svenstaro' Haase (sh@lutzhaase.com)
19 #
20
21 #### Change these settings to modify how this ISO is built.
22 # The directory that we use for working files.
23 WORKDIR="work"
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
24 # Directory on the iso where our stuff is installed.
25 INSTALL_DIR=lglive
4eafa41 Sven-Hendrik Haase Initial commit
authored
26 # Output directory for built images.
27 OUTDIR="out"
28 # Directory where packages are cached.
29 PKGCACHE="pkgcache"
30 # The name of our ISO. Does not specify the architecture!
31 NAME="lglive"
32 # Version will be appended to the ISO.
ef44f2f Sven-Hendrik Haase Increasing version number and adding note about kernel version
authored
33 VER="0.9.7"
4eafa41 Sven-Hendrik Haase Initial commit
authored
34 # Kernel version. We'll need this.
ffa5f68 Sven-Hendrik Haase Fixed project to work with recent archiso versions
authored
35 KVER="$(grep ^ALL_kver /etc/mkinitcpio.d/kernel26.kver | cut -d= -f2 | sed s/\'//g)"
ef44f2f Sven-Hendrik Haase Increasing version number and adding note about kernel version
authored
36 #KVER="2.6.38" # You shouldn't attempt to make this on a kernel you aren't running.
4eafa41 Sven-Hendrik Haase Initial commit
authored
37 # Architecture will also be appended to the ISO name.
38 ARCH="i686"
39 #ARCH="`uname -m`" # we can't build x86_64 just yet! :(
40 # Bootloader for our livecd/liveusb to use. Valid values: "grub-gfx", "syslinux"
41 # However, "syslinux" is the only acceptable value at the moment because it is
42 # not possible to build hybrid images using grub as of this writing.
43 BOOTLOADER="syslinux"
44 # A list of packages to install, either space separated in a string or line separated in a file. Can include groups.
45 PACKAGES="`cat packages.list` ${BOOTLOADER}"
46 # Directory we originate from.
47 BASEDIR="`pwd`"
48 # Resulting long name for iso/img.
49 FULLNAME="${BASEDIR}/${OUTDIR}/${NAME}-${VER}-${ARCH}-hybrid"
50 # Set quiet for now.
51 VERBOSE="n"
52 QUIET="n"
53 # Absolute path to makepkg.conf.
54 MAKEPKGCNF=`readlink -f makepkg.conf`
53b7ee3 Sven-Hendrik Haase Making xz default compressor
authored
55 # Compress the squashfs with this compressor. Values: "xz", "gzip", "lzo"
56 COMPRESS="xz"
4eafa41 Sven-Hendrik Haase Initial commit
authored
57
58 # usage: usage <exitvalue>
59 usage ()
60 {
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
61 echo "usage `basename "${0}"` [-v | -q] <target> .. <target>"
62 echo "options:"
63 echo " -v Be verbose"
64 echo " -q Be quiet"
65 echo " -h Usage help"
66 echo "targets:"
67 echo " 'all': makes all available targets"
68 echo " 'clean': clean workdir and outdir"
69 echo " 'lglive-lite-iso': reduced games selection; produces isohybrid for 700MB CD or USB drive"
70 echo " 'lglive-big-iso': full games selection; produces isohybrid for 4700MB DVD or USB drive"
71 exit $1
4eafa41 Sven-Hendrik Haase Initial commit
authored
72 }
73
74 # overlay: overlay <target>
75 overlay ()
76 {
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
77 TARGET="$1"
78 echo ${TARGET} | grep -q "lite" && gamelist=gamelist_lite || gamelist=gamelist_big
79 [ ! ${QUIET} == "y" ] && echo "===== Making overlay ====="
80 [ ! ${QUIET} == "y" ] && echo "overlay: Target is: ${TARGET}"
4eafa41 Sven-Hendrik Haase Initial commit
authored
81
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
82 [ ! ${QUIET} == "y" ] && echo "overlay: Updating drivers"
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
83 cd "${BASEDIR}/overlay/opt/drivers"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
84 [ ! ${QUIET} == "y" ] && echo "overlay: Cleaning old drivers"
85 rm *.tar.* &> /dev/null
86 find . -type l|xargs rm &> /dev/null
87 [ ! ${QUIET} == "y" ] && echo "overlay: Making NVIDIA driver packages"
4eafa41 Sven-Hendrik Haase Initial commit
authored
88 if [ ${VERBOSE} == "y" ]; then
038abce Sven-Hendrik Haase Updating driver handling, removing prelegacy nvidia
authored
89 pacman -Sywd --config ${BASEDIR}/pacman.conf --cachedir `pwd` --noconfirm nvidia nvidia-utils nvidia-173xx nvidia-173xx-utils
4eafa41 Sven-Hendrik Haase Initial commit
authored
90 else
038abce Sven-Hendrik Haase Updating driver handling, removing prelegacy nvidia
authored
91 pacman -Sywd --config ${BASEDIR}/pacman.conf --cachedir `pwd` --noconfirm nvidia nvidia-utils nvidia-173xx nvidia-173xx-utils &> /dev/null
4eafa41 Sven-Hendrik Haase Initial commit
authored
92 fi
93 [ "$?" -ne 0 ] && echo -e "\e[01;31moverlay: Exiting due to error while getting NVIDIA driver packages\e[00m" && exit 1
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
94 mv -f `ls nvidia-173xx*pkg.tar.*|grep -v utils` nvidia-legacy.tar.xz || return 1
95 mv -f `ls nvidia-173xx*pkg.tar.*|grep utils` nvidia-utils-legacy.tar.xz || return 1
038abce Sven-Hendrik Haase Updating driver handling, removing prelegacy nvidia
authored
96 mv -f `ls nvidia-*pkg.tar.*|grep -v utils|grep -v 173xx` nvidia-recent.tar.xz || return 1
97 mv -f `ls nvidia-*pkg.tar.*|grep utils|grep -v 173xx` nvidia-utils-recent.tar.xz || return 1
4eafa41 Sven-Hendrik Haase Initial commit
authored
98
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
99 [ ! ${QUIET} == "y" ] && echo "overlay: Making ATI driver package"
3b200f3 Sven-Hendrik Haase Fixed ATI package building
authored
100 if [ ${VERBOSE} == "y" ]; then
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
101 pacman -Sywd --config ${BASEDIR}/pacman.conf --cachedir `pwd` --noconfirm catalyst
3b200f3 Sven-Hendrik Haase Fixed ATI package building
authored
102 else
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
103 pacman -Sywd --config ${BASEDIR}/pacman.conf --cachedir `pwd` --noconfirm catalyst &> /dev/null
104 fi
105 [ "$?" -ne 0 ] && echo -e "\e[01;31moverlay: Exiting due to error while making ATI driver packages\e[00m" && exit 1
106 mv -f `ls catalyst-*.tar.*|grep -v utils` catalyst-recent.tar.xz || return 1
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
107 cd "${BASEDIR}"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
108 [ ! ${QUIET} == "y" ] && echo "overlay: Finished preparing driver packages"
4eafa41 Sven-Hendrik Haase Initial commit
authored
109
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
110 [ ! ${QUIET} == "y" ] && echo "overlay: Setting gamelist '$gamelist'"
111 [ ! ${QUIET} == "y" ] && echo "overlay: Deleting old copied game data"
112 cp -rp "${BASEDIR}"/overlay "${BASEDIR}"/"${WORKDIR}"/overlay/ || return 1
113 if [ ${gamelist} == "gamelist_lite" ]; then
114 cp -f "${BASEDIR}"/gamelist_lite "${BASEDIR}"/"${WORKDIR}"/overlay/
115 elif [ ${gamelist} == "gamelist_big" ]; then
116 cp -f "${BASEDIR}"/gamelist_{lite,big} "${BASEDIR}"/"${WORKDIR}"/overlay/
117 fi
7ad37f7 Sven-Hendrik Haase Cleanups, docs, games update
authored
118
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
119 if [ ${VERBOSE} == "y" ]; then
120 pacman -Sy --config ${BASEDIR}/pacman.conf --dbpath "${BASEDIR}"/"${WORKDIR}"/root-image/var/lib/pacman || return 1
121 else
122 pacman -Sy --config ${BASEDIR}/pacman.conf --dbpath "${BASEDIR}"/"${WORKDIR}"/root-image/var/lib/pacman &> /dev/null || return 1
123 fi
7ad37f7 Sven-Hendrik Haase Cleanups, docs, games update
authored
124
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
125 mkdir -p "${BASEDIR}/${WORKDIR}/overlay/opt/games/" || return 1
ecad704 Sven-Hendrik Haase Changing while loop into for loop because pacman seems to group packages...
authored
126 for game in $(cat ${BASEDIR}/${gamelist}); do
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
127 [ ! ${QUIET} == "y" ] && echo "overlay: Installing ${game}"
128 if [ ${VERBOSE} == "y" ]; then
ecad704 Sven-Hendrik Haase Changing while loop into for loop because pacman seems to group packages...
authored
129 echo "pacman -S --config ${BASEDIR}/pacman.conf --noconfirm --root \"${BASEDIR}/${WORKDIR}/overlay/\" --dbpath \"${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman\" ${game} || return 1"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
130 pacman -S --config ${BASEDIR}/pacman.conf --noconfirm --root "${BASEDIR}/${WORKDIR}/overlay/" --dbpath "${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman" ${game} || return 1
131 else
132 pacman -S --config ${BASEDIR}/pacman.conf --noconfirm --root "${BASEDIR}/${WORKDIR}/overlay/" --dbpath "${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman" ${game} &> /dev/null || return 1
133 fi
134 if [ -d "${BASEDIR}/games/${game}" ]; then
135 cp -rp "${BASEDIR}/games/${game}" "${BASEDIR}/${WORKDIR}/overlay/opt/games/" || return 1
136 fi
ecad704 Sven-Hendrik Haase Changing while loop into for loop because pacman seems to group packages...
authored
137 done
7ad37f7 Sven-Hendrik Haase Cleanups, docs, games update
authored
138
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
139 cd "${BASEDIR}"
140 #[ ! ${QUIET} == "y" ] && echo "overlay: Copying overlay to workdir"
141 #cp -rpL overlay "${WORKDIR}/" || return 1
142 [ "$?" -ne 0 ] && echo -e "\e[01;31moverlay: Exiting due to error while copying overlay\e[00m" && exit 1
143 [ ! ${QUIET} == "y" ] && echo "===== Finished overlay ====="
144 return 0
4eafa41 Sven-Hendrik Haase Initial commit
authored
145 }
146
147 base-iso ()
148 {
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
149 [ ! ${QUIET} == "y" ] && echo "===== Making base-iso ====="
150 [ ! ${QUIET} == "y" ] && echo "base-iso: Copying boot-files"
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
151 mv "${WORKDIR}/root-image/boot" "${WORKDIR}/iso/${INSTALL_DIR}/boot" || true
152 mv "${WORKDIR}/iso/${INSTALL_DIR}/boot/memtest86+/memtest.bin" "${WORKDIR}/iso/${INSTALL_DIR}/boot/memtest"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
153 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting due to error while moving boot files\e[00m" && exit 1
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
154 mkdir -p ${WORKDIR}/iso/syslinux
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
155 cp boot-files/splash.png ${WORKDIR}/iso/${INSTALL_DIR}/boot/ || return 1
156 cp boot-files/syslinux/* ${WORKDIR}/iso/syslinux/ || return 1
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
157 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting due to error while copying boot files\e[00m" && exit 1
158 [ ! ${QUIET} == "y" ] && echo "base-iso: Preparing isomounts"
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
159 cp isomounts "${WORKDIR}/iso/${INSTALL_DIR}/isomounts" || return 1
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
160 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting because no isomounts file was found\e[00m" && exit 1
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
161 sed -i "s|@ARCH@|${ARCH}|g" "${WORKDIR}/iso/${INSTALL_DIR}/isomounts"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
162 [ ! ${QUIET} == "y" ] && echo "base-iso: Making initrd image"
163 git clone git://projects.archlinux.org/archiso.git archiso-temp &>/dev/null || return 1
164 cp -r archiso-temp/archiso/{hooks,install} ${BASEDIR}/${WORKDIR}/root-image/lib/initcpio/ || return 1
165 # TODO: Hacky workaround until klibc-utils fstype supports udf
166 #sed '/if mount -r -t "${_FSTYPE}" \/dev\/archiso \/bootmnt >\/dev\/null 2>&1; then/c\if mount -r -t udf \/dev\/archiso \/bootmnt >\/dev\/null 2>&1; then' -i ${BASEDIR}/${WORKDIR}/root-image/lib/initcpio/hooks/archiso || return 1
167 rm -r archiso-temp
168 cp ${BASEDIR}/mkinitcpio.conf ${BASEDIR}/${WORKDIR}/root-image/etc/mkinitcpio.conf || return 1
169 if [ ${VERBOSE} == "y" ]; then
170 chroot ${BASEDIR}/${WORKDIR}/root-image mkinitcpio -c /etc/mkinitcpio.conf -k ${KVER} -g "/lglive.img" || return 1
171 else
172 chroot ${BASEDIR}/${WORKDIR}/root-image mkinitcpio -c /etc/mkinitcpio.conf -k ${KVER} -g "/lglive.img" &>/dev/null || return 1
173 fi
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
174 mv ${BASEDIR}/${WORKDIR}/root-image/lglive.img "${BASEDIR}/${WORKDIR}/iso/${INSTALL_DIR}/boot/lglive.img" &>/dev/null ||return 1
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
175 sed -i "s/^CacheDir/\#CacheDir/" "${BASEDIR}/${WORKDIR}/root-image/etc/pacman.conf"
176 sed -i "/localrepo/,+2d" "${BASEDIR}/${WORKDIR}/root-image/etc/pacman.conf"
177 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting due to error while running mkinitcpio\e[00m" && exit 1
178 [ ! ${QUIET} == "y" ] && echo "===== Finished base-iso ====="
179 return 0
4eafa41 Sven-Hendrik Haase Initial commit
authored
180 }
181
182 root-image ()
183 {
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
184 [ ! ${QUIET} == "y" ] && echo "===== Making root-image ====="
185 [ ! -d "${BASEDIR}"/"${OUTDIR}" ] && mkdir "${BASEDIR}"/"${OUTDIR}"
186 [ ! -d "${BASEDIR}"/"${WORKDIR}" ] && mkdir "${BASEDIR}"/"${WORKDIR}"
187 [ ! -d "${BASEDIR}"/"${PKGCACHE}" ] && mkdir "${BASEDIR}"/"${PKGCACHE}"
188 sed -i "s|^CacheDir.*$|CacheDir = ${BASEDIR}\/${PKGCACHE}|" pacman.conf
189 sed -i "/localrepo/{n; s|.*|Server = file\:\/\/${BASEDIR}/localrepo\/|}" pacman.conf
190 [ ! ${QUIET} == "y" ] && echo "root-image: Installing packages"
191 if [ ${VERBOSE} == "y" ]; then
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
192 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p base -v create "${WORKDIR}"
193 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p "${PACKAGES}" -v create "${WORKDIR}"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
194 else
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
195 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p base -v create "${WORKDIR}" &> /dev/null
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
196 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p "${PACKAGES}" -v create "${WORKDIR}" &> /dev/null
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
197 fi
198 rm -r "${BASEDIR}"/"${WORKDIR}"/root-image/home/* || true
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
199 #rm -r "${BASEDIR}"/"${WORKDIR}"/root-image/root/* || true
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
200 [ "$?" -ne 0 ] && echo -e "\e[01;31mroot-image: Exiting due to error with mkarchiso\e[00m" && exit 1
201 [ ! ${QUIET} == "y" ] && echo "===== Finished root-image ====="
202 return 0
4eafa41 Sven-Hendrik Haase Initial commit
authored
203 }
204
205 bootloader ()
206 {
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
207 [ ! ${QUIET} == "y" ] && echo "===== Making bootloader ====="
208 if [ ${BOOTLOADER} == "grub-gfx" ]; then
209 [ ! ${QUIET} == "y" ] && echo "bootloader: Copying files for 'grub-gfx'"
210 cp -r "${WORKDIR}/root-image/usr/lib/grub/i386-pc/"* "${WORKDIR}/iso/boot/grub" || return 1
211 [ "$?" -ne 0 ] && echo -e "\e[01;31mbootloader: Exiting due to error while copying bootloader\e[00m" && exit 1
212 elif [ ${BOOTLOADER} == "syslinux" ]; then
213 [ ! ${QUIET} == "y" ] && echo "bootloader: Copying files for 'syslinux'"
a3f051a Sven-Hendrik Haase Merging INSTALL_DIR changes
authored
214 cp "${WORKDIR}/root-image/usr/lib/syslinux/isolinux.bin" "${WORKDIR}/iso/syslinux/" || return 1
215 cp "${WORKDIR}/root-image/usr/lib/syslinux/memdisk" "${WORKDIR}/iso/syslinux/" || return 1
216 cp "${WORKDIR}/root-image/usr/lib/syslinux/pxelinux.0" "${WORKDIR}/iso/syslinux/" || return 1
217 cp "${WORKDIR}/root-image/usr/lib/syslinux/gpxelinux.0" "${WORKDIR}/iso/syslinux/" || return 1
218 cp "${WORKDIR}/root-image/usr/lib/syslinux/"*.c32 "${WORKDIR}/iso/syslinux/" || return 1
219 cp "${WORKDIR}/root-image/usr/lib/syslinux/poweroff.com" "${WORKDIR}/iso/syslinux/" || return 1
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
220 #sed "s|archisolabel=[^ ]*|archisolabel=${NAME}-${VER//./}|" -i ${WORKDIR}/iso/boot/pxelinux.cfg/default || return 1
221 [ "$?" -ne 0 ] && echo -e "\e[01;31mbootloader Exiting due to error while copying bootloader\e[00m" && exit 1
222 fi
223 [ ! ${QUIET} == "y" ] && echo "===== Finished bootloader ====="
224 return 0
4eafa41 Sven-Hendrik Haase Initial commit
authored
225 }
226
227 # build: build <target>
228 build ()
229 {
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
230 TARGET="$1"
696343c Sven-Hendrik Haase Fixed ATI package building
authored
231
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
232 #TODO: Persistent storage
233 #dd if=/dev/zero of="${BASEDIR}"/"${WORKDIR}"/iso/persistent.ext4 bs=1M count=4
234 #mkfs.ext4 -m0 -F "${BASEDIR}"/"${WORKDIR}"/iso/persistent.ext4
235 #mkdir "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
236 #mount -o loop -t ext4 "${BASEDIR}"/"${WORKDIR}"/iso/persistent.ext4 "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
237 #mkdir -p /tmp/archiso-mount-tmp/home/gamer/persistent
238 #umount "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
239 #rmdir "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
240 #TODO
4eafa41 Sven-Hendrik Haase Initial commit
authored
241
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
242 [ ! ${QUIET} == "y" ] && echo "===== Building final image for target: ${TARGET} ====="
243 [ ! ${QUIET} == "y" ] && echo "build: Removing ballast"
244 rm -rf "${WORKDIR}"/root-image/usr/include/*
b549d1d Sven-Hendrik Haase Also remove /usr/share/doc/
authored
245 rm -rf "${WORKDIR}"/root-image/usr/src/*
246 rm -rf "${WORKDIR}"/root-image/usr/share/doc/*
b6b1a80 Sven-Hendrik Haase Completely remove man pages
authored
247 rm -rf "${WORKDIR}"/root-image/usr/share/man/*
54a1bed Sven-Hendrik Haase Image size adjustments
authored
248 pacman -Rsn --root "${BASEDIR}/${WORKDIR}/root-image/" --dbpath "${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman" --config ${BASEDIR}/pacman.conf --noconfirm man-db man-pages || return 1
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
249 #pacman -Q --root "${BASEDIR}/${WORKDIR}/root-image/" --dbpath "${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman" --config ${BASEDIR}/pacman.conf --noconfirm doxygen && pacman -Rsn --root "${BASEDIR}/${WORKDIR}/root-image/" --dbpath "${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman" --config ${BASEDIR}/pacman.conf --noconfirm doxygen
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
250 echo ${TARGET} | grep -q "lite" && edition="lite" || edition="big"
251 [ ! ${QUIET} == "y" ] && echo "build: Setting edition to '${edition}'"
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
252 [ ! ${QUIET} == "y" ] && echo "build: Saving to ${FULLNAME}-${edition}.iso"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
253 [ ! ${QUIET} == "y" ] && echo "build: Starting build, this will take some time"
254 if [ ${VERBOSE} == "y" ]; then
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
255 mkarchiso -D ${INSTALL_DIR} -c ${COMPRESS} -f -v -L "${NAME}-${VER//./}" -P "Linux-Gamers <live.linux-gamers.net>" -A "live.linux-gamers" -p "${BOOTLOADER}" iso "${WORKDIR}" "${FULLNAME}-${edition}.iso"
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
256 else
95a975e Sven-Hendrik Haase Finalizing fixes for merge to new archiso upstream
authored
257 mkarchiso -D ${INSTALL_DIR} -c ${COMPRESS} -f -v -L "${NAME}-${VER//./}" -P "Linux-Gamers <live.linux-gamers.net>" -A "live.linux-gamers" -p "${BOOTLOADER}" iso "${WORKDIR}" "${FULLNAME}-${edition}.iso" &> /dev/null
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
258 fi
259 [ "$?" -ne 0 ] && echo -e "\e[01;31mbuild: Exiting due to error while running mkarchiso\e[00m" && exit 1
260 [ ! ${QUIET} == "y" ] && echo "===== Finished building final image for target: ${TARGET} ====="
261 return 0
4eafa41 Sven-Hendrik Haase Initial commit
authored
262 }
263
264 clean ()
265 {
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
266 [ ! ${QUIET} == "y" ] && echo "===== Cleaning ====="
267 [ ! ${QUIET} == "y" ] && echo "clean: Deleting '${BASEDIR}/${WORKDIR}'"
268 rm -rf "${BASEDIR}/${WORKDIR}"
269 [ "$?" -ne 0 ] && echo -e "\e[01;31mclean: Exiting due to error while cleaning workdir\e[00m" && exit 1
270 [ ! ${QUIET} == "y" ] && echo "===== Cleaning finished successfully ====="
271 return 0
4eafa41 Sven-Hendrik Haase Initial commit
authored
272 }
273
274 # Catch options here
275 while getopts "hvq" opt; do
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
276 case "${opt}" in
277 v) VERBOSE="y" ;;
278 q) QUIET="y" ;;
279 h|?) usage 0 ;;
280 *) echo "ERROR: Invalid argument '${opt}'"; usage 1 ;;
281 esac
4eafa41 Sven-Hendrik Haase Initial commit
authored
282 done
283
284 shift $(($OPTIND - 1))
285
286 if [ $# -lt 1 ]; then
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
287 echo "ERROR: No build targets"
288 usage 1
4eafa41 Sven-Hendrik Haase Initial commit
authored
289 fi
290
291 if [ "${USER}" != "root" ]; then
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
292 echo "ERROR: Need to be root"
293 exit 1
4eafa41 Sven-Hendrik Haase Initial commit
authored
294 fi
295
296 START_TIME=`date +%s`
297 START_DATE=`date`
298
299 LAUNCH_ARGS="$@"
300
301 if echo "$@" | grep -q "clean"; then
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
302 clean
303 exit 0
4eafa41 Sven-Hendrik Haase Initial commit
authored
304 fi
305
306 if echo "$@" | grep -q "all"; then
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
307 LAUNCH_ARGS="lglive-lite-iso lglive-big-iso"
4eafa41 Sven-Hendrik Haase Initial commit
authored
308 fi
309
310 for arg in ${LAUNCH_ARGS}; do
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
311 if [[ ${arg} != "lglive-lite-iso" && ${arg} != "lglive-big-iso" ]]; then
312 echo "ERROR: Invalid target"
313 usage 1
314 fi
315 [ ! ${QUIET} == "y" ] && echo -e "\e[01;33m===== Starting build for target: ${arg} =====\e[00m"
316 clean || (echo -e "\e[01;31mclean: Exiting due to error while cleaning\e[00m"; exit 1)
317 root-image || (echo -e "\e[01;31mroot-image: Exiting due to error while making root-image\e[00m"; exit 1)
318 base-iso || (echo -e "\e[01;31mbase-iso: Exiting due to error while making base-iso\e[00m"; exit 1)
319 overlay ${arg} || (echo -e "\e[01;31moverlay: Exiting due to error while making overlay\e[00m"; exit 1) # pass target info to get correct gameset
320 bootloader || (echo -e "\e[01;31mbootloader: Exiting due to error while making bootloader\e[00m"; exit 1)
321 build ${arg} || (echo -e "\e[01;31mbuild: Exiting due to error while building iso\e[00m"; exit 1) # pass target info to build correct image
322 [ ! ${QUIET} == "y" ] && echo -e "\e[01;33m===== Finished build for target: ${arg} =====\e[00m"
4eafa41 Sven-Hendrik Haase Initial commit
authored
323 done
324
325 END_TIME=`date +%s`
326 ELAPSED=`expr ${END_TIME} - ${START_TIME}`
327 h=$(( ELAPSED / 3600 ))
328 m=$(( ( ELAPSED / 60 ) % 60 ))
329 s=$(( ELAPSED % 60 ))
330 echo -e "\e[01;34m===== FINISHED ALL BUILDS =====\e[00m"
331 echo "BUILDING STARTED at" ${START_DATE}
332 echo "BUILDING FINISHED at" `date`
333 printf "ELAPSED TIME: %02d:%02d:%02d\n" $h $m $s
334 du -h out/*
335
d930014 Sven-Hendrik Haase Fixed overlay/opt/games directory not being created
authored
336 # vim:ts=2:sw=2:et
4eafa41 Sven-Hendrik Haase Initial commit
authored
337
Something went wrong with that request. Please try again.