Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 336 lines (304 sloc) 16.616 kB
4eafa41 @svenstaro 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 @svenstaro Merging INSTALL_DIR changes
authored
24 # Directory on the iso where our stuff is installed.
25 INSTALL_DIR=lglive
4eafa41 @svenstaro 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 @svenstaro Increasing version number and adding note about kernel version
authored
33 VER="0.9.7"
4eafa41 @svenstaro Initial commit
authored
34 # Kernel version. We'll need this.
ffa5f68 @svenstaro 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 @svenstaro 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 @svenstaro 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.
cd6602d @svenstaro Fix kernel panic with current [testing]
authored
45
46 # hacky fix till dcron is out of base
47 BASE_PACKAGES=$(pacman -Sgq base | grep -v dcron)
48
4eafa41 @svenstaro Initial commit
authored
49 PACKAGES="`cat packages.list` ${BOOTLOADER}"
50 # Directory we originate from.
51 BASEDIR="`pwd`"
52 # Resulting long name for iso/img.
53 FULLNAME="${BASEDIR}/${OUTDIR}/${NAME}-${VER}-${ARCH}-hybrid"
54 # Set quiet for now.
55 VERBOSE="n"
56 QUIET="n"
57 # Absolute path to makepkg.conf.
58 MAKEPKGCNF=`readlink -f makepkg.conf`
53b7ee3 @svenstaro Making xz default compressor
authored
59 # Compress the squashfs with this compressor. Values: "xz", "gzip", "lzo"
60 COMPRESS="xz"
4eafa41 @svenstaro Initial commit
authored
61
62 # usage: usage <exitvalue>
63 usage ()
64 {
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
65 echo "usage `basename "${0}"` [-v | -q] <target> .. <target>"
66 echo "options:"
67 echo " -v Be verbose"
68 echo " -q Be quiet"
69 echo " -h Usage help"
70 echo "targets:"
71 echo " 'all': makes all available targets"
72 echo " 'clean': clean workdir and outdir"
73 echo " 'lglive-lite-iso': reduced games selection; produces isohybrid for 700MB CD or USB drive"
74 echo " 'lglive-big-iso': full games selection; produces isohybrid for 4700MB DVD or USB drive"
75 exit $1
4eafa41 @svenstaro Initial commit
authored
76 }
77
78 # overlay: overlay <target>
79 overlay ()
80 {
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
81 TARGET="$1"
82 echo ${TARGET} | grep -q "lite" && gamelist=gamelist_lite || gamelist=gamelist_big
83 [ ! ${QUIET} == "y" ] && echo "===== Making overlay ====="
84 [ ! ${QUIET} == "y" ] && echo "overlay: Target is: ${TARGET}"
4eafa41 @svenstaro Initial commit
authored
85
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
86 [ ! ${QUIET} == "y" ] && echo "overlay: Updating drivers"
95a975e @svenstaro Finalizing fixes for merge to new archiso upstream
authored
87 cd "${BASEDIR}/overlay/opt/drivers"
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
88 [ ! ${QUIET} == "y" ] && echo "overlay: Cleaning old drivers"
89 rm *.tar.* &> /dev/null
90 find . -type l|xargs rm &> /dev/null
91 [ ! ${QUIET} == "y" ] && echo "overlay: Making NVIDIA driver packages"
4eafa41 @svenstaro Initial commit
authored
92 if [ ${VERBOSE} == "y" ]; then
d1e4eb0 @svenstaro buildscript.sh: Using chroot pacman db rather than system's own
authored
93 pacman -Sywd --config ${BASEDIR}/pacman.conf --dbpath "${BASEDIR}"/"${WORKDIR}"/root-image/var/lib/pacman --cachedir `pwd` --noconfirm nvidia nvidia-utils nvidia-173xx nvidia-173xx-utils
4eafa41 @svenstaro Initial commit
authored
94 else
d1e4eb0 @svenstaro buildscript.sh: Using chroot pacman db rather than system's own
authored
95 pacman -Sywd --config ${BASEDIR}/pacman.conf --dbpath "${BASEDIR}"/"${WORKDIR}"/root-image/var/lib/pacman --cachedir `pwd` --noconfirm nvidia nvidia-utils nvidia-173xx nvidia-173xx-utils &> /dev/null
4eafa41 @svenstaro Initial commit
authored
96 fi
97 [ "$?" -ne 0 ] && echo -e "\e[01;31moverlay: Exiting due to error while getting NVIDIA driver packages\e[00m" && exit 1
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
98 mv -f `ls nvidia-173xx*pkg.tar.*|grep -v utils` nvidia-legacy.tar.xz || return 1
99 mv -f `ls nvidia-173xx*pkg.tar.*|grep utils` nvidia-utils-legacy.tar.xz || return 1
038abce @svenstaro Updating driver handling, removing prelegacy nvidia
authored
100 mv -f `ls nvidia-*pkg.tar.*|grep -v utils|grep -v 173xx` nvidia-recent.tar.xz || return 1
101 mv -f `ls nvidia-*pkg.tar.*|grep utils|grep -v 173xx` nvidia-utils-recent.tar.xz || return 1
4eafa41 @svenstaro Initial commit
authored
102
95a975e @svenstaro Finalizing fixes for merge to new archiso upstream
authored
103 cd "${BASEDIR}"
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
104 [ ! ${QUIET} == "y" ] && echo "overlay: Finished preparing driver packages"
4eafa41 @svenstaro Initial commit
authored
105
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
106 [ ! ${QUIET} == "y" ] && echo "overlay: Setting gamelist '$gamelist'"
107 [ ! ${QUIET} == "y" ] && echo "overlay: Deleting old copied game data"
108 cp -rp "${BASEDIR}"/overlay "${BASEDIR}"/"${WORKDIR}"/overlay/ || return 1
109 if [ ${gamelist} == "gamelist_lite" ]; then
110 cp -f "${BASEDIR}"/gamelist_lite "${BASEDIR}"/"${WORKDIR}"/overlay/
111 elif [ ${gamelist} == "gamelist_big" ]; then
112 cp -f "${BASEDIR}"/gamelist_{lite,big} "${BASEDIR}"/"${WORKDIR}"/overlay/
113 fi
7ad37f7 @svenstaro Cleanups, docs, games update
authored
114
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
115 if [ ${VERBOSE} == "y" ]; then
116 pacman -Sy --config ${BASEDIR}/pacman.conf --dbpath "${BASEDIR}"/"${WORKDIR}"/root-image/var/lib/pacman || return 1
117 else
118 pacman -Sy --config ${BASEDIR}/pacman.conf --dbpath "${BASEDIR}"/"${WORKDIR}"/root-image/var/lib/pacman &> /dev/null || return 1
119 fi
7ad37f7 @svenstaro Cleanups, docs, games update
authored
120
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
121 mkdir -p "${BASEDIR}/${WORKDIR}/overlay/opt/games/" || return 1
ecad704 @svenstaro Changing while loop into for loop because pacman seems to group packa…
authored
122 for game in $(cat ${BASEDIR}/${gamelist}); do
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
123 [ ! ${QUIET} == "y" ] && echo "overlay: Installing ${game}"
124 if [ ${VERBOSE} == "y" ]; then
ecad704 @svenstaro Changing while loop into for loop because pacman seems to group packa…
authored
125 echo "pacman -S --config ${BASEDIR}/pacman.conf --noconfirm --root \"${BASEDIR}/${WORKDIR}/overlay/\" --dbpath \"${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman\" ${game} || return 1"
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
126 pacman -S --config ${BASEDIR}/pacman.conf --noconfirm --root "${BASEDIR}/${WORKDIR}/overlay/" --dbpath "${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman" ${game} || return 1
127 else
128 pacman -S --config ${BASEDIR}/pacman.conf --noconfirm --root "${BASEDIR}/${WORKDIR}/overlay/" --dbpath "${BASEDIR}/${WORKDIR}/root-image/var/lib/pacman" ${game} &> /dev/null || return 1
129 fi
130 if [ -d "${BASEDIR}/games/${game}" ]; then
131 cp -rp "${BASEDIR}/games/${game}" "${BASEDIR}/${WORKDIR}/overlay/opt/games/" || return 1
132 fi
ecad704 @svenstaro Changing while loop into for loop because pacman seems to group packa…
authored
133 done
7ad37f7 @svenstaro Cleanups, docs, games update
authored
134
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
135 cd "${BASEDIR}"
136 #[ ! ${QUIET} == "y" ] && echo "overlay: Copying overlay to workdir"
137 #cp -rpL overlay "${WORKDIR}/" || return 1
138 [ "$?" -ne 0 ] && echo -e "\e[01;31moverlay: Exiting due to error while copying overlay\e[00m" && exit 1
139 [ ! ${QUIET} == "y" ] && echo "===== Finished overlay ====="
140 return 0
4eafa41 @svenstaro Initial commit
authored
141 }
142
143 base-iso ()
144 {
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
145 [ ! ${QUIET} == "y" ] && echo "===== Making base-iso ====="
146 [ ! ${QUIET} == "y" ] && echo "base-iso: Copying boot-files"
1fd3fde @svenstaro Changing paths to conform to archiso's defaults
authored
147 mkdir -p ${WORKDIR}/iso/${INSTALL_DIR}/boot/${ARCH}
148 cp "${WORKDIR}/root-image/boot/System.map26" "${WORKDIR}/iso/${INSTALL_DIR}/boot/${ARCH}/"
149 cp "${WORKDIR}/root-image/boot/vmlinuz26" "${WORKDIR}/iso/${INSTALL_DIR}/boot/${ARCH}/"
150 cp "${WORKDIR}/root-image/boot/memtest86+/memtest.bin" "${WORKDIR}/iso/${INSTALL_DIR}/boot/memtest"
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
151 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting due to error while moving boot files\e[00m" && exit 1
a3f051a @svenstaro Merging INSTALL_DIR changes
authored
152 mkdir -p ${WORKDIR}/iso/syslinux
95a975e @svenstaro Finalizing fixes for merge to new archiso upstream
authored
153 cp boot-files/splash.png ${WORKDIR}/iso/${INSTALL_DIR}/boot/ || return 1
154 cp boot-files/syslinux/* ${WORKDIR}/iso/syslinux/ || return 1
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
155 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting due to error while copying boot files\e[00m" && exit 1
156 [ ! ${QUIET} == "y" ] && echo "base-iso: Preparing isomounts"
a3f051a @svenstaro Merging INSTALL_DIR changes
authored
157 cp isomounts "${WORKDIR}/iso/${INSTALL_DIR}/isomounts" || return 1
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
158 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting because no isomounts file was found\e[00m" && exit 1
a3f051a @svenstaro Merging INSTALL_DIR changes
authored
159 sed -i "s|@ARCH@|${ARCH}|g" "${WORKDIR}/iso/${INSTALL_DIR}/isomounts"
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
160 [ ! ${QUIET} == "y" ] && echo "base-iso: Making initrd image"
161 git clone git://projects.archlinux.org/archiso.git archiso-temp &>/dev/null || return 1
162 cp -r archiso-temp/archiso/{hooks,install} ${BASEDIR}/${WORKDIR}/root-image/lib/initcpio/ || return 1
163 rm -r archiso-temp
164 cp ${BASEDIR}/mkinitcpio.conf ${BASEDIR}/${WORKDIR}/root-image/etc/mkinitcpio.conf || return 1
165 if [ ${VERBOSE} == "y" ]; then
166 chroot ${BASEDIR}/${WORKDIR}/root-image mkinitcpio -c /etc/mkinitcpio.conf -k ${KVER} -g "/lglive.img" || return 1
167 else
168 chroot ${BASEDIR}/${WORKDIR}/root-image mkinitcpio -c /etc/mkinitcpio.conf -k ${KVER} -g "/lglive.img" &>/dev/null || return 1
169 fi
1fd3fde @svenstaro Changing paths to conform to archiso's defaults
authored
170 mv ${BASEDIR}/${WORKDIR}/root-image/lglive.img "${BASEDIR}/${WORKDIR}/iso/${INSTALL_DIR}/boot/${ARCH}/lglive.img" &>/dev/null || return 1
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
171 sed -i "s/^CacheDir/\#CacheDir/" "${BASEDIR}/${WORKDIR}/root-image/etc/pacman.conf"
172 sed -i "/localrepo/,+2d" "${BASEDIR}/${WORKDIR}/root-image/etc/pacman.conf"
173 [ "$?" -ne 0 ] && echo -e "\e[01;31mbase-iso: Exiting due to error while running mkinitcpio\e[00m" && exit 1
174 [ ! ${QUIET} == "y" ] && echo "===== Finished base-iso ====="
175 return 0
4eafa41 @svenstaro Initial commit
authored
176 }
177
178 root-image ()
179 {
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
180 [ ! ${QUIET} == "y" ] && echo "===== Making root-image ====="
181 [ ! -d "${BASEDIR}"/"${OUTDIR}" ] && mkdir "${BASEDIR}"/"${OUTDIR}"
182 [ ! -d "${BASEDIR}"/"${WORKDIR}" ] && mkdir "${BASEDIR}"/"${WORKDIR}"
183 [ ! -d "${BASEDIR}"/"${PKGCACHE}" ] && mkdir "${BASEDIR}"/"${PKGCACHE}"
184 sed -i "s|^CacheDir.*$|CacheDir = ${BASEDIR}\/${PKGCACHE}|" pacman.conf
185 sed -i "/localrepo/{n; s|.*|Server = file\:\/\/${BASEDIR}/localrepo\/|}" pacman.conf
186 [ ! ${QUIET} == "y" ] && echo "root-image: Installing packages"
187 if [ ${VERBOSE} == "y" ]; then
cd6602d @svenstaro Fix kernel panic with current [testing]
authored
188 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p "${BASE_PACKAGES}" -v create "${WORKDIR}" || return 1
189 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p "${PACKAGES}" -v create "${WORKDIR}" || return 1
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
190 else
cd6602d @svenstaro Fix kernel panic with current [testing]
authored
191 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p "${BASE_PACKAGES}" -v create "${WORKDIR}" &> /dev/null || return 1
192 mkarchiso -D ${INSTALL_DIR} -C pacman.conf -p "${PACKAGES}" -v create "${WORKDIR}" &> /dev/null || return 1
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
193 fi
194 rm -r "${BASEDIR}"/"${WORKDIR}"/root-image/home/* || true
ee44d13 @svenstaro buildscript.sh: Copy preconfigured pacman.conf into iso
authored
195 grep -v localrepo "${BASEDIR}"/pacman.conf > "${BASEDIR}"/"${WORKDIR}"/root-image/etc/pacman.conf
95a975e @svenstaro Finalizing fixes for merge to new archiso upstream
authored
196 #rm -r "${BASEDIR}"/"${WORKDIR}"/root-image/root/* || true
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
197 [ "$?" -ne 0 ] && echo -e "\e[01;31mroot-image: Exiting due to error with mkarchiso\e[00m" && exit 1
198 [ ! ${QUIET} == "y" ] && echo "===== Finished root-image ====="
199 return 0
4eafa41 @svenstaro Initial commit
authored
200 }
201
202 bootloader ()
203 {
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
204 [ ! ${QUIET} == "y" ] && echo "===== Making bootloader ====="
205 if [ ${BOOTLOADER} == "grub-gfx" ]; then
206 [ ! ${QUIET} == "y" ] && echo "bootloader: Copying files for 'grub-gfx'"
207 cp -r "${WORKDIR}/root-image/usr/lib/grub/i386-pc/"* "${WORKDIR}/iso/boot/grub" || return 1
208 [ "$?" -ne 0 ] && echo -e "\e[01;31mbootloader: Exiting due to error while copying bootloader\e[00m" && exit 1
209 elif [ ${BOOTLOADER} == "syslinux" ]; then
210 [ ! ${QUIET} == "y" ] && echo "bootloader: Copying files for 'syslinux'"
a3f051a @svenstaro Merging INSTALL_DIR changes
authored
211 cp "${WORKDIR}/root-image/usr/lib/syslinux/isolinux.bin" "${WORKDIR}/iso/syslinux/" || return 1
212 cp "${WORKDIR}/root-image/usr/lib/syslinux/memdisk" "${WORKDIR}/iso/syslinux/" || return 1
213 cp "${WORKDIR}/root-image/usr/lib/syslinux/pxelinux.0" "${WORKDIR}/iso/syslinux/" || return 1
214 cp "${WORKDIR}/root-image/usr/lib/syslinux/gpxelinux.0" "${WORKDIR}/iso/syslinux/" || return 1
215 cp "${WORKDIR}/root-image/usr/lib/syslinux/"*.c32 "${WORKDIR}/iso/syslinux/" || return 1
216 cp "${WORKDIR}/root-image/usr/lib/syslinux/poweroff.com" "${WORKDIR}/iso/syslinux/" || return 1
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
217 #sed "s|archisolabel=[^ ]*|archisolabel=${NAME}-${VER//./}|" -i ${WORKDIR}/iso/boot/pxelinux.cfg/default || return 1
218 [ "$?" -ne 0 ] && echo -e "\e[01;31mbootloader Exiting due to error while copying bootloader\e[00m" && exit 1
219 fi
220 [ ! ${QUIET} == "y" ] && echo "===== Finished bootloader ====="
221 return 0
4eafa41 @svenstaro Initial commit
authored
222 }
223
224 # build: build <target>
225 build ()
226 {
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
227 TARGET="$1"
696343c @svenstaro Fixed ATI package building
authored
228
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
229 #TODO: Persistent storage
230 #dd if=/dev/zero of="${BASEDIR}"/"${WORKDIR}"/iso/persistent.ext4 bs=1M count=4
231 #mkfs.ext4 -m0 -F "${BASEDIR}"/"${WORKDIR}"/iso/persistent.ext4
232 #mkdir "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
233 #mount -o loop -t ext4 "${BASEDIR}"/"${WORKDIR}"/iso/persistent.ext4 "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
234 #mkdir -p /tmp/archiso-mount-tmp/home/gamer/persistent
235 #umount "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
236 #rmdir "${BASEDIR}"/"${WORKDIR}"/archiso-mount-tmp
237 #TODO
4eafa41 @svenstaro Initial commit
authored
238
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
239 [ ! ${QUIET} == "y" ] && echo "===== Building final image for target: ${TARGET} ====="
240 [ ! ${QUIET} == "y" ] && echo "build: Removing ballast"
b549d1d @svenstaro Also remove /usr/share/doc/
authored
241 rm -rf "${WORKDIR}"/root-image/usr/src/*
242 rm -rf "${WORKDIR}"/root-image/usr/share/doc/*
b6b1a80 @svenstaro Completely remove man pages
authored
243 rm -rf "${WORKDIR}"/root-image/usr/share/man/*
7cd1449 @svenstaro Freeing up some space by removing unneeded stuff
authored
244 rm -rf "${WORKDIR}"/overlay/usr/share/doc/*
245 rm -rf "${WORKDIR}"/overlay/usr/share/man/*
76a4eaf @svenstaro buildscript.sh: Don't clean packages that don't exist
authored
246 #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 @svenstaro Finalizing fixes for merge to new archiso upstream
authored
247 #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 @svenstaro Fixed overlay/opt/games directory not being created
authored
248 echo ${TARGET} | grep -q "lite" && edition="lite" || edition="big"
249 [ ! ${QUIET} == "y" ] && echo "build: Setting edition to '${edition}'"
95a975e @svenstaro Finalizing fixes for merge to new archiso upstream
authored
250 [ ! ${QUIET} == "y" ] && echo "build: Saving to ${FULLNAME}-${edition}.iso"
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
251 [ ! ${QUIET} == "y" ] && echo "build: Starting build, this will take some time"
252 if [ ${VERBOSE} == "y" ]; then
95a975e @svenstaro Finalizing fixes for merge to new archiso upstream
authored
253 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 @svenstaro Fixed overlay/opt/games directory not being created
authored
254 else
95a975e @svenstaro 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" &> /dev/null
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
256 fi
257 [ "$?" -ne 0 ] && echo -e "\e[01;31mbuild: Exiting due to error while running mkarchiso\e[00m" && exit 1
258 [ ! ${QUIET} == "y" ] && echo "===== Finished building final image for target: ${TARGET} ====="
259 return 0
4eafa41 @svenstaro Initial commit
authored
260 }
261
262 clean ()
263 {
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
264 [ ! ${QUIET} == "y" ] && echo "===== Cleaning ====="
265 [ ! ${QUIET} == "y" ] && echo "clean: Deleting '${BASEDIR}/${WORKDIR}'"
266 rm -rf "${BASEDIR}/${WORKDIR}"
267 [ "$?" -ne 0 ] && echo -e "\e[01;31mclean: Exiting due to error while cleaning workdir\e[00m" && exit 1
268 [ ! ${QUIET} == "y" ] && echo "===== Cleaning finished successfully ====="
269 return 0
4eafa41 @svenstaro Initial commit
authored
270 }
271
272 # Catch options here
273 while getopts "hvq" opt; do
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
274 case "${opt}" in
275 v) VERBOSE="y" ;;
276 q) QUIET="y" ;;
277 h|?) usage 0 ;;
278 *) echo "ERROR: Invalid argument '${opt}'"; usage 1 ;;
279 esac
4eafa41 @svenstaro Initial commit
authored
280 done
281
282 shift $(($OPTIND - 1))
283
284 if [ $# -lt 1 ]; then
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
285 echo "ERROR: No build targets"
286 usage 1
4eafa41 @svenstaro Initial commit
authored
287 fi
288
289 if [ "${USER}" != "root" ]; then
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
290 echo "ERROR: Need to be root"
291 exit 1
4eafa41 @svenstaro Initial commit
authored
292 fi
293
294 START_TIME=`date +%s`
295 START_DATE=`date`
296
297 LAUNCH_ARGS="$@"
298
299 if echo "$@" | grep -q "clean"; then
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
300 clean
301 exit 0
4eafa41 @svenstaro Initial commit
authored
302 fi
303
304 if echo "$@" | grep -q "all"; then
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
305 LAUNCH_ARGS="lglive-lite-iso lglive-big-iso"
4eafa41 @svenstaro Initial commit
authored
306 fi
307
308 for arg in ${LAUNCH_ARGS}; do
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
309 if [[ ${arg} != "lglive-lite-iso" && ${arg} != "lglive-big-iso" ]]; then
310 echo "ERROR: Invalid target"
311 usage 1
312 fi
313 [ ! ${QUIET} == "y" ] && echo -e "\e[01;33m===== Starting build for target: ${arg} =====\e[00m"
314 clean || (echo -e "\e[01;31mclean: Exiting due to error while cleaning\e[00m"; exit 1)
315 root-image || (echo -e "\e[01;31mroot-image: Exiting due to error while making root-image\e[00m"; exit 1)
316 base-iso || (echo -e "\e[01;31mbase-iso: Exiting due to error while making base-iso\e[00m"; exit 1)
317 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
318 bootloader || (echo -e "\e[01;31mbootloader: Exiting due to error while making bootloader\e[00m"; exit 1)
319 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
320 [ ! ${QUIET} == "y" ] && echo -e "\e[01;33m===== Finished build for target: ${arg} =====\e[00m"
4eafa41 @svenstaro Initial commit
authored
321 done
322
323 END_TIME=`date +%s`
324 ELAPSED=`expr ${END_TIME} - ${START_TIME}`
325 h=$(( ELAPSED / 3600 ))
326 m=$(( ( ELAPSED / 60 ) % 60 ))
327 s=$(( ELAPSED % 60 ))
328 echo -e "\e[01;34m===== FINISHED ALL BUILDS =====\e[00m"
329 echo "BUILDING STARTED at" ${START_DATE}
330 echo "BUILDING FINISHED at" `date`
331 printf "ELAPSED TIME: %02d:%02d:%02d\n" $h $m $s
332 du -h out/*
333
d930014 @svenstaro Fixed overlay/opt/games directory not being created
authored
334 # vim:ts=2:sw=2:et
4eafa41 @svenstaro Initial commit
authored
335
Something went wrong with that request. Please try again.