2014-12-08 23:50:56 +01:00
#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2015-01-28 21:05:18 +01:00
[ [ -r ${ LIBDIR } /util-iso-image.sh ] ] && source ${ LIBDIR } /util-iso-image.sh
2015-01-29 05:16:15 +01:00
[ [ -r ${ LIBDIR } /util-iso-calamares.sh ] ] && source ${ LIBDIR } /util-iso-calamares.sh
# $1: function
run_log( ) {
logfile = ${ cache_dir_iso } /${ buildset_iso } .log
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
logpipe = $( mktemp -u "/tmp/logpipe.XXXXXXXX" )
mkfifo " $logpipe "
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
tee " $logfile " < " $logpipe " &
local teepid = $!
$1 & > " $logpipe "
wait $teepid
rm " $logpipe "
}
2014-12-14 04:27:24 +01:00
2015-02-09 20:34:37 +01:00
check_run_dir( ) {
if [ [ ! -f shared/Packages ] ] ; then
2015-02-09 23:48:29 +01:00
die " ${ 0 ##*/ } is not run in a valid iso-profiles folder! "
2015-02-09 20:34:37 +01:00
fi
}
2015-02-09 23:39:33 +01:00
check_profile( ) {
if [ [ ! -f $1 /initsys ] ] ; then
2015-02-09 23:48:29 +01:00
die " $1 is not a valid profile! "
2015-02-09 23:39:33 +01:00
fi
}
2014-12-13 01:59:24 +01:00
copy_initcpio( ) {
2015-01-29 00:17:15 +01:00
cp /usr/lib/initcpio/hooks/miso* $1 /usr/lib/initcpio/hooks
cp /usr/lib/initcpio/install/miso* $1 /usr/lib/initcpio/install
cp mkinitcpio.conf $1 /etc/mkinitcpio-${ manjaroiso } .conf
2014-12-13 01:59:24 +01:00
}
2014-12-19 04:29:18 +01:00
copy_overlay_root( ) {
2014-12-16 05:29:46 +01:00
msg2 "Copying overlay ..."
2014-12-14 13:37:09 +01:00
cp -a --no-preserve= ownership overlay/* $1
2014-12-12 05:18:17 +01:00
}
2015-01-29 05:16:15 +01:00
copy_overlay_custom( ) {
msg2 " Copying ${ custom } -overlay ... "
cp -a --no-preserve= ownership ${ custom } -overlay/* ${ work_dir } /${ custom } -image
2014-12-12 05:18:17 +01:00
}
2014-12-12 17:36:29 +01:00
copy_overlay_livecd( ) {
2014-12-16 05:29:46 +01:00
msg2 "Copying overlay-livecd ..."
2014-12-21 01:42:17 +01:00
if [ [ -L overlay-livecd ] ] ; then
2014-12-20 23:21:26 +01:00
cp -a --no-preserve= ownership overlay-livecd/* $1
else
2015-01-16 13:52:35 +01:00
msg2 "Copying custom overlay-livecd ..."
2014-12-21 00:10:15 +01:00
cp -LR overlay-livecd/* $1
2014-12-20 23:21:26 +01:00
fi
2014-12-12 17:36:29 +01:00
}
2014-12-19 04:29:18 +01:00
copy_startup_scripts( ) {
msg2 "Copying startup scripts ..."
2014-12-15 04:03:50 +01:00
cp ${ PKGDATADIR } /scripts/livecd $1
2014-12-19 16:18:35 +01:00
cp ${ PKGDATADIR } /scripts/mhwd-live $1
2015-01-29 07:24:30 +01:00
2014-12-15 04:15:36 +01:00
# fix script permissions
chmod +x $1 /livecd
2014-12-19 16:18:35 +01:00
chmod +x $1 /mhwd-live
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
# cp ${BINDIR}/chroot-run $1
2014-12-19 17:46:25 +01:00
2014-12-14 04:27:24 +01:00
# fix paths
2015-01-29 05:16:15 +01:00
# sed -e "s|${LIBDIR}|/opt/livecd|g" -i $1/chroot-run
2014-12-12 17:36:29 +01:00
}
2014-12-14 04:27:24 +01:00
copy_livecd_helpers( ) {
2015-01-29 07:24:30 +01:00
msg2 "Copying livecd helpers ..."
2014-12-19 19:49:37 +01:00
[ [ ! -d $1 ] ] && mkdir -p $1
2014-12-14 03:48:14 +01:00
cp ${ LIBDIR } /util-livecd.sh $1
2015-02-02 06:43:01 +01:00
2014-12-14 04:27:24 +01:00
cp ${ LIBDIR } /util-msg.sh $1
cp ${ LIBDIR } /util.sh $1
2015-01-29 07:24:30 +01:00
# cp ${LIBDIR}/util-mount.sh $1
2014-12-19 04:29:18 +01:00
2014-12-14 04:27:24 +01:00
if [ [ -f ${ USER_CONFIG } /manjaro-tools.conf ] ] ; then
2014-12-16 05:29:46 +01:00
msg2 " Copying ${ USER_CONFIG } /manjaro-tools.conf ... "
2014-12-14 04:27:24 +01:00
cp ${ USER_CONFIG } /manjaro-tools.conf $1
else
2014-12-16 05:29:46 +01:00
msg2 " Copying ${ manjaro_tools_conf } ... "
2014-12-15 03:54:22 +01:00
cp ${ manjaro_tools_conf } $1
2015-01-29 07:24:30 +01:00
fi
2015-02-02 06:45:48 +01:00
# write the custom var to conf to be sourced for use in util-livecd
2015-02-09 00:24:39 +01:00
echo '' >> $1 /manjaro-tools.conf
echo '#Custom image name' >> $1 /manjaro-tools.conf
2015-02-02 06:45:48 +01:00
echo " custom= ${ custom } " >> $1 /manjaro-tools.conf
2014-12-11 03:54:02 +01:00
}
2014-12-14 07:10:36 +01:00
copy_cache_lng( ) {
msg2 "Copying lng cache ..."
2015-01-14 23:14:44 +01:00
cp ${ cache_dir_lng } /* ${ work_dir } /lng-image/opt/livecd/lng
2014-12-14 07:10:36 +01:00
}
2015-01-14 23:14:44 +01:00
copy_cache_xorg( ) {
msg2 "Copying xorg pkgs cache ..."
cp ${ cache_dir_xorg } /* ${ work_dir } /pkgs-image/opt/livecd/pkgs
2014-12-14 07:10:36 +01:00
}
2015-01-15 02:49:21 +01:00
prepare_cachedirs( ) {
2015-01-15 04:38:47 +01:00
[ [ ! -d " ${ cache_dir_iso } " ] ] && mkdir -p " ${ cache_dir_iso } "
2015-01-15 02:49:21 +01:00
[ [ ! -d " ${ cache_dir_xorg } " ] ] && mkdir -p " ${ cache_dir_xorg } "
[ [ ! -d " ${ cache_dir_lng } " ] ] && mkdir -p " ${ cache_dir_lng } "
2014-12-14 07:10:36 +01:00
}
2014-12-18 05:07:04 +01:00
clean_cache( ) {
msg " Cleaning [ $1 ] ... "
find " $1 " -name '*.pkg.tar.xz' -delete & >/dev/null
2014-12-08 23:50:56 +01:00
}
clean_up( ) {
if [ [ -d ${ work_dir } ] ] ; then
2014-12-16 05:29:46 +01:00
msg " Removing [ ${ work_dir } ] ... "
2014-12-08 23:50:56 +01:00
rm -r ${ work_dir }
fi
}
2015-01-29 05:16:15 +01:00
configure_custom_image( ) {
2015-02-12 22:11:33 +01:00
msg " Configuring [ ${ custom } -image] "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_plymouth " $1 "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_displaymanager " $1 "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_services " $1 "
2015-01-29 07:24:30 +01:00
2015-02-12 22:11:33 +01:00
msg " Done configuring [ ${ custom } -image] "
2015-01-16 13:52:35 +01:00
}
2014-12-19 16:18:35 +01:00
configure_livecd_image( ) {
2015-02-12 22:11:33 +01:00
msg "Configuring [livecd-image]"
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_hostname " $1 "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_hosts " $1 "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_accountsservice " $1 " " ${ username } "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_user " $1 "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_services_live " $1 "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_calamares " $1 "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_thus " $1 "
2015-01-29 07:24:30 +01:00
2015-02-12 22:11:33 +01:00
msg "Done configuring [livecd-image]"
2014-12-18 04:30:19 +01:00
}
2015-01-29 00:17:15 +01:00
# $1: work_dir
gen_boot_image( ) {
local _kernver = $( cat $1 /usr/lib/modules/*-MANJARO/version)
chroot-run $1 \
2015-01-13 04:48:04 +01:00
/usr/bin/mkinitcpio -k ${ _kernver } \
-c /etc/mkinitcpio-${ manjaroiso } .conf \
-g /boot/${ img_name } .img
}
2014-12-12 05:18:17 +01:00
make_repo( ) {
repo-add ${ work_dir } /pkgs-image/opt/livecd/pkgs/gfx-pkgs.db.tar.gz ${ work_dir } /pkgs-image/opt/livecd/pkgs/*pkg*z
}
2014-12-15 23:12:04 +01:00
# $1: work dir
# $2: cache dir
# $3: pkglist
download_to_cache( ) {
pacman -v --config " ${ pacman_conf } " \
--arch " ${ arch } " --root " $1 " \
--cache $2 \
-Syw $3 --noconfirm
}
2014-12-08 23:50:56 +01:00
# Build ISO
make_iso( ) {
2014-12-16 05:29:46 +01:00
msg "Start [Build ISO]"
2014-12-08 23:50:56 +01:00
touch " ${ work_dir } /iso/.miso "
2015-01-29 07:24:30 +01:00
2015-01-26 23:54:45 +01:00
mkiso ${ iso_args [*] } iso " ${ work_dir } " " ${ cache_dir_iso } / ${ iso_file } "
2015-01-14 23:43:12 +01:00
2015-01-15 04:38:47 +01:00
chown -R " ${ OWNER } :users " " ${ cache_dir_iso } "
2014-12-16 05:29:46 +01:00
msg "Done [Build ISO]"
2014-12-12 05:18:17 +01:00
}
2015-01-26 21:48:37 +01:00
# $1: file
2015-01-29 00:17:15 +01:00
make_checksum( ) {
2015-01-26 23:54:45 +01:00
cd ${ cache_dir_iso }
2015-01-27 00:21:06 +01:00
msg " Creating [ ${ checksum_mode } sum] ... "
local cs = $( ${ checksum_mode } sum $1 )
msg2 " ${ checksum_mode } sum: ${ cs } "
2015-01-27 00:31:01 +01:00
echo " ${ cs } " > $1 .${ checksum_mode }
2015-01-27 00:21:06 +01:00
msg " Done [ ${ checksum_mode } sum] "
2015-01-26 23:54:45 +01:00
cd ..
2015-01-26 21:48:37 +01:00
}
2015-01-09 16:23:46 +01:00
# $1: new branch
aufs_mount_root_image( ) {
2015-01-29 19:15:29 +01:00
msg2 " mount [root-image] on [ ${ 1 ##*/ } ] "
mount -t aufs -o br = " $1 " :${ work_dir } /root-image= ro none " $1 "
2015-01-09 16:23:46 +01:00
}
# $1: add branch
2015-01-20 20:47:39 +01:00
aufs_append_root_image( ) {
2015-01-29 19:15:29 +01:00
msg2 " append [root-image] on [ ${ 1 ##*/ } ] "
mount -t aufs -o remount,append:${ work_dir } /root-image= ro none " $1 "
2015-01-20 20:47:39 +01:00
}
# $1: add branch
2015-01-29 18:37:25 +01:00
aufs_mount_custom_image( ) {
2015-01-29 19:15:29 +01:00
msg2 " mount [ ${ 1 ##*/ } ] on [ ${ custom } -image] "
mount -t aufs -o br = " $1 " :${ work_dir } /${ custom } -image= ro none " $1 "
2015-01-09 16:23:46 +01:00
}
2015-01-09 22:45:32 +01:00
# $1: del branch
aufs_remove_image( ) {
2015-01-29 19:15:29 +01:00
if mountpoint -q " $1 " ; then
2015-01-29 01:12:23 +01:00
msg2 " unmount ${ 1 ##*/ } "
2015-01-09 22:45:32 +01:00
umount $1
fi
}
2015-01-26 02:09:18 +01:00
umount_image_handler( ) {
aufs_remove_image " ${ work_dir } /livecd-image "
2015-01-29 05:16:15 +01:00
aufs_remove_image " ${ work_dir } / ${ custom } -image "
2015-01-26 02:09:18 +01:00
aufs_remove_image " ${ work_dir } /root-image "
aufs_remove_image " ${ work_dir } /pkgs-image "
aufs_remove_image " ${ work_dir } /lng-image "
aufs_remove_image " ${ work_dir } /boot-image "
}
2015-01-26 22:54:49 +01:00
mkiso_error_handler( ) {
umount_image_handler
die "Exiting..."
}
2014-12-08 23:50:56 +01:00
# Base installation (root-image)
2015-01-13 04:48:04 +01:00
make_image_root( ) {
2014-12-08 23:50:56 +01:00
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg "Prepare [Base installation] (root-image)"
2015-01-10 15:53:11 +01:00
2015-01-29 18:37:25 +01:00
local path = " ${ work_dir } /root-image "
2015-01-29 17:13:45 +01:00
2015-01-26 22:54:49 +01:00
mkiso ${ create_args [*] } -p " ${ packages } " -i "root-image" create " ${ work_dir } " || mkiso_error_handler
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
pacman -Qr " ${ path } " > " ${ path } /root-image-pkgs.txt "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
if [ -e ${ path } /boot/grub/grub.cfg ] ; then
rm ${ path } /boot/grub/grub.cfg
2014-12-08 23:50:56 +01:00
fi
2015-01-29 17:13:45 +01:00
if [ -e ${ path } /etc/lsb-release ] ; then
sed -i -e " s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE= ${ iso_version } / " ${ path } /etc/lsb-release
2015-02-07 11:46:26 +01:00
sed -i -e " s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME= ${ code_name } / " ${ path } /etc/lsb-release
2014-12-08 23:50:56 +01:00
fi
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
copy_overlay_root " ${ path } "
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg "Done [Base installation] (root-image)"
2014-12-10 19:06:52 +01:00
fi
}
2015-01-29 05:16:15 +01:00
make_image_custom( ) {
2014-12-08 23:50:56 +01:00
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
msg " Prepare [ ${ custom } installation] ( ${ custom } -image) "
2015-01-29 07:24:30 +01:00
2015-01-29 18:37:25 +01:00
local path = " ${ work_dir } / ${ custom } -image "
2015-01-29 17:13:45 +01:00
mkdir -p ${ path }
2015-01-29 07:24:30 +01:00
2015-01-26 02:09:18 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 19:55:57 +01:00
aufs_mount_root_image " ${ path } "
2014-12-08 23:50:56 +01:00
2015-01-29 05:16:15 +01:00
mkiso ${ create_args [*] } -i " ${ custom } -image " -p " ${ packages } " create " ${ work_dir } " || mkiso_error_handler
2015-01-11 01:51:57 +01:00
2015-01-29 17:13:45 +01:00
pacman -Qr " ${ path } " > " ${ path } / ${ custom } -image-pkgs.txt "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
cp " ${ path } / ${ custom } -image-pkgs.txt " ${ cache_dir_iso } /${ img_name } -${ custom } -${ iso_version } -${ arch } -pkgs.txt
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
[ [ -d ${ custom } -overlay ] ] && copy_overlay_custom
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_custom_image " ${ path } "
2015-01-29 07:24:30 +01:00
2015-01-26 19:59:12 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
rm -R ${ path } /.wh*
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
msg " Done [ ${ custom } installation] ( ${ custom } -image) "
2014-12-08 23:50:56 +01:00
fi
}
2015-01-13 04:48:04 +01:00
make_image_livecd( ) {
2014-12-15 23:12:04 +01:00
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 07:24:30 +01:00
2014-12-19 16:18:35 +01:00
msg "Prepare [livecd-image]"
2015-01-29 07:24:30 +01:00
2015-01-29 18:37:25 +01:00
local path = " ${ work_dir } /livecd-image "
2015-01-29 17:13:45 +01:00
mkdir -p ${ path }
2015-01-29 07:24:30 +01:00
2015-01-26 02:09:18 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
if [ [ -n " ${ custom } " ] ] ; then
2015-01-29 18:37:25 +01:00
aufs_mount_custom_image " ${ path } "
2015-01-29 17:13:45 +01:00
aufs_append_root_image " ${ path } "
2015-01-20 20:47:39 +01:00
else
2015-01-29 17:13:45 +01:00
aufs_mount_root_image " ${ path } "
2014-12-08 23:50:56 +01:00
fi
2015-01-29 07:24:30 +01:00
2015-01-29 00:43:36 +01:00
mkiso ${ create_args [*] } -i "livecd-image" -p " ${ packages } " create " ${ work_dir } " || mkiso_error_handler
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
pacman -Qr " ${ path } " > " ${ path } /livecd-image-pkgs.txt "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
copy_overlay_livecd " ${ path } "
2015-01-21 13:28:41 +01:00
2015-01-14 23:43:12 +01:00
# copy over setup helpers and config loader
2015-01-29 17:13:45 +01:00
copy_livecd_helpers " ${ path } /opt/livecd "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
copy_startup_scripts " ${ path } /usr/bin "
2015-01-29 07:24:30 +01:00
2015-01-30 02:14:36 +01:00
configure_livecd_image " ${ path } "
2015-01-29 07:24:30 +01:00
2014-12-15 23:12:04 +01:00
# Clean up GnuPG keys?
2015-01-29 17:13:45 +01:00
rm -rf " ${ path } /etc/pacman.d/gnupg "
2015-01-29 07:24:30 +01:00
2015-01-26 19:59:12 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
rm -R ${ path } /.wh*
2015-01-29 07:24:30 +01:00
2014-12-15 23:12:04 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-19 16:18:35 +01:00
msg "Done [livecd-image]"
2014-12-15 23:12:04 +01:00
fi
}
2015-01-13 04:48:04 +01:00
make_image_xorg( ) {
2014-12-11 07:36:41 +01:00
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 17:13:45 +01:00
2014-12-16 05:29:46 +01:00
msg "Prepare [pkgs-image]"
2015-01-29 07:24:30 +01:00
2015-01-29 18:37:25 +01:00
local path = " ${ work_dir } /pkgs-image "
2015-01-29 17:13:45 +01:00
mkdir -p ${ path } /opt/livecd/pkgs
2015-01-29 07:24:30 +01:00
2015-01-26 02:09:18 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
if [ [ -n " ${ custom } " ] ] ; then
2015-01-29 18:37:25 +01:00
aufs_mount_custom_image " ${ path } "
2015-01-29 17:13:45 +01:00
aufs_append_root_image " ${ path } "
2015-01-20 20:47:39 +01:00
else
2015-01-29 17:13:45 +01:00
aufs_mount_root_image " ${ path } "
2014-12-11 07:36:41 +01:00
fi
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
download_to_cache " ${ path } " " ${ cache_dir_xorg } " " ${ packages_xorg } "
2015-01-14 23:14:44 +01:00
copy_cache_xorg
2015-01-29 07:24:30 +01:00
2014-12-20 14:15:27 +01:00
if [ [ -n " ${ packages_xorg_cleanup } " ] ] ; then
2015-01-29 07:24:30 +01:00
for xorg_clean in ${ packages_xorg_cleanup } ; do
2015-01-29 17:13:45 +01:00
rm ${ path } /opt/livecd/pkgs/${ xorg_clean }
2014-12-11 07:36:41 +01:00
done
fi
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
cp ${ PKGDATADIR } /pacman-gfx.conf ${ path } /opt/livecd
rm -r ${ path } /var
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
make_repo " ${ path } /opt/livecd/pkgs/gfx-pkgs " " ${ path } /opt/livecd/pkgs "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
configure_xorg_drivers " ${ path } "
2015-01-29 07:24:30 +01:00
2015-01-26 19:59:12 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
rm -R ${ path } /.wh*
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg "Done [pkgs-image]"
2014-12-08 23:50:56 +01:00
fi
}
2015-01-13 04:48:04 +01:00
make_image_lng( ) {
2014-12-08 23:50:56 +01:00
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 17:13:45 +01:00
2014-12-16 05:29:46 +01:00
msg "Prepare [lng-image]"
2015-01-29 17:13:45 +01:00
2015-01-29 18:37:25 +01:00
local path = " ${ work_dir } /lng-image "
2015-01-29 17:13:45 +01:00
mkdir -p ${ path } /opt/livecd/lng
2015-01-29 07:24:30 +01:00
2015-01-26 02:09:18 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
if [ [ -n " ${ custom } " ] ] ; then
2015-01-29 18:37:25 +01:00
aufs_mount_custom_image " ${ path } "
2015-01-29 17:13:45 +01:00
aufs_append_root_image " ${ path } "
2015-01-20 20:47:39 +01:00
else
2015-01-29 17:13:45 +01:00
aufs_mount_root_image " ${ path } "
2014-12-08 23:50:56 +01:00
fi
2014-12-10 19:06:52 +01:00
2014-12-20 14:15:27 +01:00
if [ [ -n ${ packages_lng_kde } ] ] ; then
2015-01-29 17:13:45 +01:00
download_to_cache " ${ path } " " ${ cache_dir_lng } " " ${ packages_lng } ${ packages_lng_kde } "
2014-12-18 05:07:04 +01:00
copy_cache_lng
2014-12-08 23:50:56 +01:00
else
2015-01-29 17:13:45 +01:00
download_to_cache " ${ path } " " ${ cache_dir_lng } " " ${ packages_lng } "
2014-12-18 05:07:04 +01:00
copy_cache_lng
2014-12-08 23:50:56 +01:00
fi
2015-01-29 07:24:30 +01:00
2014-12-20 14:15:27 +01:00
if [ [ -n " ${ packages_lng_cleanup } " ] ] ; then
2014-12-19 16:18:35 +01:00
for lng_clean in ${ packages_lng_cleanup } ; do
2015-01-29 17:13:45 +01:00
rm ${ path } /opt/livecd/lng/${ lng_clean }
2014-12-10 19:06:52 +01:00
done
2014-12-08 23:50:56 +01:00
fi
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
cp ${ PKGDATADIR } /pacman-lng.conf ${ path } /opt/livecd
rm -r ${ path } /var
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
make_repo ${ path } /opt/livecd/lng/lng-pkgs ${ path } /opt/livecd/lng
2015-01-29 07:24:30 +01:00
2015-01-26 19:59:12 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
rm -R ${ path } /.wh*
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg "Done [lng-image]"
2014-12-08 23:50:56 +01:00
fi
}
2014-12-11 22:46:11 +01:00
2014-12-08 23:50:56 +01:00
# Prepare ${install_dir}/boot/
2015-01-13 04:48:04 +01:00
make_image_boot( ) {
2014-12-08 23:50:56 +01:00
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2014-12-16 05:29:46 +01:00
msg " Prepare [ ${ install_dir } /boot] "
2015-01-29 07:24:30 +01:00
2015-01-29 19:15:29 +01:00
local path_iso = " ${ work_dir } /iso/ ${ install_dir } /boot "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
mkdir -p ${ path_iso } /${ arch }
cp ${ work_dir } /root-image/boot/memtest86+/memtest.bin ${ path_iso } /${ arch } /memtest
cp ${ work_dir } /root-image/boot/vmlinuz* ${ path_iso } /${ arch } /${ manjaroiso }
2015-01-29 19:15:29 +01:00
local path = " ${ work_dir } /boot-image "
2015-01-29 17:13:45 +01:00
mkdir -p ${ path }
2015-01-29 07:24:30 +01:00
2015-01-26 19:59:12 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
if [ [ -n " ${ custom } " ] ] ; then
2015-01-29 18:37:25 +01:00
aufs_mount_custom_image " ${ path } "
2015-01-29 17:13:45 +01:00
aufs_append_root_image " ${ path } "
2015-01-20 20:47:39 +01:00
else
2015-01-29 17:13:45 +01:00
aufs_mount_root_image " ${ path } "
2014-12-08 23:50:56 +01:00
fi
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
copy_initcpio " ${ path } "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
gen_boot_image " ${ path } "
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
mv ${ path } /boot/${ img_name } .img ${ path_iso } /${ arch } /${ img_name } .img
cp ${ path } /boot/intel-ucode.img ${ path_iso } /intel_ucode.img
cp ${ path } /usr/share/licenses/intel-ucode/LICENSE ${ path_iso } /intel_ucode.LICENSE
2015-01-29 07:24:30 +01:00
2015-01-26 19:59:12 +01:00
umount_image_handler
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
rm -R ${ path }
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg " Done [ ${ install_dir } /boot] "
2014-12-08 23:50:56 +01:00
fi
}
# Prepare /EFI
make_efi( ) {
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
msg " Prepare [ ${ install_dir } /boot/EFI] "
2015-01-29 19:15:29 +01:00
local path_iso = " ${ work_dir } /iso "
local path_efi = " ${ path_iso } /EFI "
2015-01-29 17:13:45 +01:00
mkdir -p ${ path_efi } /boot
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
cp ${ work_dir } /root-image/usr/lib/prebootloader/PreLoader.efi ${ path_efi } /boot/bootx64.efi
cp ${ work_dir } /root-image/usr/lib/prebootloader/HashTool.efi ${ path_efi } /boot/
cp ${ work_dir } /root-image/usr/lib/gummiboot/gummibootx64.efi ${ path_efi } /boot/loader.efi
2014-12-08 23:50:56 +01:00
2015-01-29 17:13:45 +01:00
mkdir -p ${ path_iso } /loader/entries
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
cp efiboot/loader/loader.conf ${ path_iso } /loader/
cp efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${ path_iso } /loader/entries/
cp efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${ path_iso } /loader/entries/
2014-12-08 23:50:56 +01:00
sed " s|%MISO_LABEL%| ${ iso_label } |g;
s| %INSTALL_DIR%| ${ install_dir } | g" \
2015-01-29 17:13:45 +01:00
efiboot/loader/entries/${ manjaroiso } -x86_64-usb.conf > ${ path_iso } /loader/entries/${ manjaroiso } -x86_64.conf
2014-12-08 23:50:56 +01:00
sed " s|%MISO_LABEL%| ${ iso_label } |g;
s| %INSTALL_DIR%| ${ install_dir } | g" \
2015-01-29 17:13:45 +01:00
efiboot/loader/entries/${ manjaroiso } -x86_64-nonfree-usb.conf > ${ path_iso } /loader/entries/${ manjaroiso } -x86_64-nonfree.conf
2014-12-08 23:50:56 +01:00
# EFI Shell 2.0 for UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UEFI_Shell )
2015-01-29 17:13:45 +01:00
curl -k -o ${ path_efi } /shellx64_v2.efi https://svn.code.sf.net/p/edk2/code/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi
2014-12-08 23:50:56 +01:00
# EFI Shell 1.0 for non UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Efi-shell )
2015-01-29 17:13:45 +01:00
curl -k -o ${ path_efi } /shellx64_v1.efi https://svn.code.sf.net/p/edk2/code/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg " Done [ ${ install_dir } /boot/EFI] "
2014-12-08 23:50:56 +01:00
fi
}
# Prepare kernel.img::/EFI for "El Torito" EFI boot mode
make_efiboot( ) {
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
msg " Prepare [ ${ install_dir } /iso/EFI] "
2015-01-29 19:15:29 +01:00
local path_iso = " ${ work_dir } /iso "
2015-01-29 17:13:45 +01:00
mkdir -p ${ path_iso } /EFI/miso
truncate -s 31M ${ path_iso } /EFI/miso/${ img_name } .img
mkfs.vfat -n MISO_EFI ${ path_iso } /EFI/miso/${ img_name } .img
2014-12-08 23:50:56 +01:00
mkdir -p ${ work_dir } /efiboot
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
mount ${ path_iso } /EFI/miso/${ img_name } .img ${ work_dir } /efiboot
2015-01-29 19:15:29 +01:00
local path_efi = " ${ work_dir } /efiboot/EFI "
2014-12-08 23:50:56 +01:00
2015-01-29 17:13:45 +01:00
mkdir -p ${ path_efi } /miso
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
cp ${ path_iso } /${ install_dir } /boot/x86_64/${ manjaroiso } ${ path_efi } /miso/${ manjaroiso } .efi
cp ${ path_iso } /${ install_dir } /boot/x86_64/${ img_name } .img ${ path_efi } /miso/${ img_name } .img
cp ${ path_iso } /${ install_dir } /boot/intel_ucode.img ${ path_efi } /miso/intel_ucode.img
2014-12-08 23:50:56 +01:00
2015-01-29 17:13:45 +01:00
mkdir -p ${ path_efi } /boot
2015-01-29 07:24:30 +01:00
2015-01-29 17:13:45 +01:00
cp ${ work_dir } /root-image/usr/lib/prebootloader/PreLoader.efi ${ path_efi } /boot/bootx64.efi
cp ${ work_dir } /root-image/usr/lib/prebootloader/HashTool.efi ${ path_efi } /boot/
cp ${ work_dir } /root-image/usr/lib/gummiboot/gummibootx64.efi ${ path_efi } /boot/loader.efi
2014-12-08 23:50:56 +01:00
mkdir -p ${ work_dir } /efiboot/loader/entries
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
cp efiboot/loader/loader.conf ${ work_dir } /efiboot/loader/
cp efiboot/loader/entries/uefi-shell-v2-x86_64.conf ${ work_dir } /efiboot/loader/entries/
cp efiboot/loader/entries/uefi-shell-v1-x86_64.conf ${ work_dir } /efiboot/loader/entries/
sed " s|%MISO_LABEL%| ${ iso_label } |g;
s| %INSTALL_DIR%| ${ install_dir } | g" \
efiboot/loader/entries/${ manjaroiso } -x86_64-dvd.conf > ${ work_dir } /efiboot/loader/entries/${ manjaroiso } -x86_64.conf
sed " s|%MISO_LABEL%| ${ iso_label } |g;
s| %INSTALL_DIR%| ${ install_dir } | g" \
efiboot/loader/entries/${ manjaroiso } -x86_64-nonfree-dvd.conf > ${ work_dir } /efiboot/loader/entries/${ manjaroiso } -x86_64-nonfree.conf
2015-01-29 17:13:45 +01:00
cp ${ path_iso } /EFI/shellx64_v2.efi ${ path_efi } /
cp ${ path_iso } /EFI/shellx64_v1.efi ${ path_efi } /
2014-12-08 23:50:56 +01:00
umount ${ work_dir } /efiboot
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg " Done [ ${ install_dir } /iso/EFI] "
2014-12-08 23:50:56 +01:00
fi
}
# Prepare /isolinux
make_isolinux( ) {
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2014-12-16 05:29:46 +01:00
msg " Prepare [ ${ install_dir } /iso/isolinux] "
2015-01-29 07:24:30 +01:00
2014-12-14 13:42:57 +01:00
mkdir -p ${ work_dir } /iso/isolinux
cp -a --no-preserve= ownership isolinux/* ${ work_dir } /iso/isolinux
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
if [ [ -e isolinux-overlay ] ] ; then
msg2 "isolinux overlay found. Overwriting files."
2014-12-14 13:42:57 +01:00
cp -a --no-preserve= ownership isolinux-overlay/* ${ work_dir } /iso/isolinux
2014-12-08 23:50:56 +01:00
fi
2015-01-29 07:24:30 +01:00
2015-01-29 19:15:29 +01:00
local path = " ${ work_dir } /root-image/usr/lib/syslinux "
2015-01-29 17:13:45 +01:00
if [ [ -e ${ path } /bios/ ] ] ; then
cp ${ path } /bios/isolinux.bin ${ work_dir } /iso/isolinux/
cp ${ path } /bios/isohdpfx.bin ${ work_dir } /iso/isolinux/
cp ${ path } /bios/ldlinux.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/gfxboot.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/whichsys.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/mboot.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/hdt.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/chain.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/libcom32.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/libmenu.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/libutil.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /bios/libgpl.c32 ${ work_dir } /iso/isolinux/
2014-12-08 23:50:56 +01:00
else
2015-01-29 17:13:45 +01:00
cp ${ path } /isolinux.bin ${ work_dir } /iso/isolinux/
cp ${ path } /isohdpfx.bin ${ work_dir } /iso/isolinux/
cp ${ path } /gfxboot.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /whichsys.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /mboot.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /hdt.c32 ${ work_dir } /iso/isolinux/
cp ${ path } /chain.c32 ${ work_dir } /iso/isolinux/
2014-12-08 23:50:56 +01:00
fi
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
sed -i " s|%MISO_LABEL%| ${ iso_label } |g;
s| %INSTALL_DIR%| ${ install_dir } | g;
s| %ARCH%| ${ arch } | g" ${ work_dir } /iso/isolinux/isolinux.cfg
2015-01-29 07:24:30 +01:00
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2014-12-16 05:29:46 +01:00
msg " Done [ ${ install_dir } /iso/isolinux] "
2014-12-08 23:50:56 +01:00
fi
}
2015-01-29 07:24:30 +01:00
gen_isomounts( ) {
2015-01-29 05:50:53 +01:00
echo '# syntax: <img> <arch> <mount point> <type> <kernel argument>' > $1
echo '# Sample kernel argument in syslinux: overlay=extra,extra2' >> $1
echo '' >> $1
2015-01-29 07:24:30 +01:00
2015-01-29 05:50:53 +01:00
msg2 "Writing livecd entry ..."
echo " ${ arch } /livecd-image.sqfs ${ arch } / squashfs " >> $1
2015-01-29 07:24:30 +01:00
2015-01-29 05:50:53 +01:00
if [ [ -f Packages-Lng ] ] ; then
msg2 "Writing lng entry ..."
echo " ${ arch } /lng-image.sqfs ${ arch } / squashfs " >> $1
fi
2015-01-29 07:24:30 +01:00
2015-01-29 05:50:53 +01:00
if [ [ -f Packages-Xorg ] ] ; then
msg2 "Writing pkgs entry ..."
echo " ${ arch } /pkgs-image.sqfs ${ arch } / squashfs " >> $1
fi
2015-01-29 07:24:30 +01:00
2015-01-29 05:50:53 +01:00
if [ [ -f " ${ packages_custom } " ] ] ; then
msg2 " Writing ${ custom } entry ... "
echo " ${ arch } / ${ custom } -image.sqfs ${ arch } / squashfs " >> $1
fi
2015-01-29 07:24:30 +01:00
2015-01-29 05:50:53 +01:00
msg2 "Writing root entry ..."
echo " ${ arch } /root-image.sqfs ${ arch } / squashfs " >> $1
}
2014-12-08 23:50:56 +01:00
make_isomounts( ) {
if [ [ ! -e ${ work_dir } /build.${ FUNCNAME } ] ] ; then
2015-01-29 05:50:53 +01:00
msg "Creating [isomounts]"
2015-01-29 07:24:30 +01:00
gen_isomounts " ${ work_dir } /iso/ ${ install_dir } /isomounts "
2014-12-08 23:50:56 +01:00
: > ${ work_dir } /build.${ FUNCNAME }
2015-01-29 07:24:30 +01:00
2015-01-29 05:50:53 +01:00
msg "Done creating [isomounts]"
2014-12-08 23:50:56 +01:00
fi
}
2015-01-29 00:17:15 +01:00
# $1: file name
load_pkgs( ) {
2015-01-29 01:12:23 +01:00
msg3 " Loading Packages: [ $1 ] ... "
2015-01-29 07:24:30 +01:00
2015-01-29 01:12:23 +01:00
if [ [ " ${ arch } " = = "i686" ] ] ; then
2015-01-29 05:16:15 +01:00
packages = $( sed "s|#.*||g" " $1 " | sed "s| ||g" | sed "s|>dvd.*||g" | sed "s|>blacklist.*||g" | sed "s|>x86_64.*||g" | sed "s|>i686||g" | sed " s|KERNEL| $manjaro_kernel |g " | sed ':a;N;$!ba;s/\n/ /g' )
2015-01-29 01:12:23 +01:00
elif [ [ " ${ arch } " = = "x86_64" ] ] ; then
2015-01-29 05:16:15 +01:00
packages = $( sed "s|#.*||g" " $1 " | sed "s| ||g" | sed "s|>dvd.*||g" | sed "s|>blacklist.*||g" | sed "s|>i686.*||g" | sed "s|>x86_64||g" | sed " s|KERNEL| $manjaro_kernel |g " | sed ':a;N;$!ba;s/\n/ /g' )
2015-01-29 00:17:15 +01:00
fi
}
2015-01-16 13:52:35 +01:00
load_pkgs_xorg( ) {
2015-01-29 01:12:23 +01:00
msg3 "Loading Packages: [Packages-Xorg] ..."
2015-01-29 07:24:30 +01:00
2015-01-29 01:12:23 +01:00
if [ [ " ${ arch } " = = "i686" ] ] ; then
2015-01-16 13:52:35 +01:00
packages_xorg = $( sed "s|#.*||g" Packages-Xorg | sed "s| ||g" | sed "s|>dvd.*||g" | sed "s|>blacklist.*||g" | sed "s|>cleanup.*||g" | sed "s|>x86_64.*||g" | sed "s|>i686||g" | sed "s|>free_x64.*||g" | sed "s|>free_uni||g" | sed "s|>nonfree_x64.*||g" | sed "s|>nonfree_uni||g" | sed " s|KERNEL| $manjaro_kernel |g " | sed ':a;N;$!ba;s/\n/ /g' )
2015-01-29 01:12:23 +01:00
elif [ [ " ${ arch } " = = "x86_64" ] ] ; then
2015-01-16 13:52:35 +01:00
packages_xorg = $( sed "s|#.*||g" Packages-Xorg | sed "s| ||g" | sed "s|>dvd.*||g" | sed "s|>blacklist.*||g" | sed "s|>cleanup.*||g" | sed "s|>i686.*||g" | sed "s|>x86_64||g" | sed "s|>free_x64||g" | sed "s|>free_uni||g" | sed "s|>nonfree_uni||g" | sed "s|>nonfree_x64||g" | sed " s|KERNEL| $manjaro_kernel |g " | sed ':a;N;$!ba;s/\n/ /g' )
fi
packages_xorg_cleanup = $( sed "s|#.*||g" Packages-Xorg | grep cleanup | sed "s|>cleanup||g" | sed " s|KERNEL| $manjaro_kernel |g " | sed ':a;N;$!ba;s/\n/ /g' )
}
2015-01-15 04:38:47 +01:00
2015-01-16 13:52:35 +01:00
load_pkgs_lng( ) {
2015-01-29 01:12:23 +01:00
msg3 "Loading Packages: [Packages-Lng] ..."
2015-01-29 00:31:47 +01:00
2015-01-29 01:12:23 +01:00
if [ [ " ${ arch } " = = "i686" ] ] ; then
2015-01-16 13:52:35 +01:00
packages_lng = $( sed "s|#.*||g" Packages-Lng | sed "s| ||g" | sed "s|>dvd.*||g" | sed "s|>blacklist.*||g" | sed "s|>cleanup.*||g" | sed "s|>x86_64.*||g" | sed "s|>i686||g" | sed "s|>kde.*||g" | sed ':a;N;$!ba;s/\n/ /g' )
2015-01-29 01:12:23 +01:00
elif [ [ " ${ arch } " = = "x86_64" ] ] ; then
2015-01-16 13:52:35 +01:00
packages_lng = $( sed "s|#.*||g" Packages-Lng | sed "s| ||g" | sed "s|>dvd.*||g" | sed "s|>blacklist.*||g" | sed "s|>cleanup.*||g" | sed "s|>i686.*||g" | sed "s|>x86_64||g" | sed "s|>kde.*||g" | sed ':a;N;$!ba;s/\n/ /g' )
fi
packages_lng_cleanup = $( sed "s|#.*||g" Packages-Lng | grep cleanup | sed "s|>cleanup||g" )
packages_lng_kde = $( sed "s|#.*||g" Packages-Lng | grep kde | sed "s|>kde||g" | sed ':a;N;$!ba;s/\n/ /g' )
}
2015-01-15 04:38:47 +01:00
2015-01-29 00:17:15 +01:00
# $1: profile
2015-01-17 19:05:18 +01:00
load_profile( ) {
2015-01-29 01:12:23 +01:00
msg3 " Profile: [ $1 ] ... "
2015-01-29 00:31:47 +01:00
2015-01-29 00:43:36 +01:00
local files = $( ls Packages*)
2015-01-29 07:24:30 +01:00
2015-01-29 00:43:36 +01:00
for f in ${ files [@] } ; do
case $f in
2015-01-29 01:12:23 +01:00
Packages| Packages-Livecd*| Packages-Xorg*| Packages-Lng*) continue ; ;
2015-01-29 05:16:15 +01:00
*) packages_custom = " $f " ; msg2 " Packages-Custom: $f " ; ;
2015-01-29 00:43:36 +01:00
esac
done
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
custom = ${ packages_custom #*- }
custom = ${ custom ,, }
2015-01-29 07:24:30 +01:00
displaymanager = " $( cat displaymanager) "
initsys = " $( cat initsys) "
2014-12-08 23:50:56 +01:00
2015-01-29 05:16:15 +01:00
iso_file = " ${ img_name } - ${ custom } - ${ iso_version } - ${ arch } .iso "
2014-12-08 23:50:56 +01:00
2015-01-16 13:52:35 +01:00
if [ [ -f pacman-${ pacman_conf_arch } .conf ] ] ; then
pacman_conf = " pacman- ${ pacman_conf_arch } .conf "
else
pacman_conf = " ${ PKGDATADIR } /pacman- ${ pacman_conf_arch } .conf "
2014-12-31 01:02:43 +01:00
fi
2015-01-16 13:52:35 +01:00
create_args += ( -C ${ pacman_conf } )
2015-01-29 07:24:30 +01:00
2015-01-29 00:17:15 +01:00
work_dir = ${ chroots_iso } /$1 /${ arch }
2015-01-29 07:24:30 +01:00
2015-02-10 01:22:36 +01:00
is_plymouth = false
source mkinitcpio.conf
for h in ${ HOOKS [@] } ; do
if [ [ $h = = 'plymouth' ] ] ; then
is_plymouth = true
fi
done
2014-12-31 01:02:43 +01:00
}
compress_images( ) {
make_iso
2015-01-29 00:17:15 +01:00
make_checksum " ${ iso_file } "
2014-12-31 01:02:43 +01:00
}
2015-01-15 02:49:21 +01:00
build_images( ) {
2015-01-29 00:17:15 +01:00
load_pkgs "Packages"
2015-01-13 04:48:04 +01:00
make_image_root
2015-01-29 07:24:30 +01:00
2015-01-29 05:16:15 +01:00
if [ [ -f " ${ packages_custom } " ] ] ; then
load_pkgs " ${ packages_custom } "
make_image_custom
2014-12-31 01:02:43 +01:00
fi
2015-01-29 00:17:15 +01:00
if [ [ -f Packages-Xorg ] ] ; then
2015-01-13 04:48:04 +01:00
load_pkgs_xorg
make_image_xorg
2014-12-31 01:02:43 +01:00
fi
2015-01-29 07:24:30 +01:00
2015-01-29 00:17:15 +01:00
if [ [ -f Packages-Lng ] ] ; then
2015-01-13 04:48:04 +01:00
load_pkgs_lng
make_image_lng
2014-12-31 01:02:43 +01:00
fi
2015-01-29 07:24:30 +01:00
2014-12-31 01:02:43 +01:00
if [ [ -f Packages-Livecd ] ] ; then
2015-01-29 00:17:15 +01:00
load_pkgs "Packages-Livecd"
2015-01-13 04:48:04 +01:00
make_image_livecd
2015-01-29 07:24:30 +01:00
fi
2015-01-15 02:49:21 +01:00
make_image_boot
2015-01-29 00:17:15 +01:00
if [ [ " ${ arch } " = = "x86_64" ] ] ; then
2015-01-15 02:49:21 +01:00
make_efi
make_efiboot
2014-12-31 01:02:43 +01:00
fi
2015-01-15 02:49:21 +01:00
make_isolinux
2015-01-29 07:24:30 +01:00
make_isomounts
2014-12-31 01:02:43 +01:00
}
2015-01-15 04:38:47 +01:00
build_profile( ) {
${ clean_first } && clean_up
${ clean_cache_xorg } && clean_cache " ${ cache_dir_xorg } "
${ clean_cache_lng } && clean_cache " ${ cache_dir_lng } "
if ${ iso_only } ; then
2015-01-15 06:22:05 +01:00
[ [ ! -d ${ work_dir } ] ] && die "You need to create images first eg. buildiso -p <name> -i"
2015-01-15 04:38:47 +01:00
compress_images
exit 1
fi
if ${ images_only } ; then
build_images
2015-01-27 21:25:17 +01:00
warning "Continue with eg. buildiso -p <name> -sc ..."
2015-01-15 04:38:47 +01:00
exit 1
else
build_images
compress_images
fi
}
build_iso( ) {
if ${ is_buildset } ; then
2015-01-17 19:05:18 +01:00
msg3 " Start building [ ${ buildset_iso } ] "
2015-01-15 04:38:47 +01:00
for prof in $( cat ${ sets_dir_iso } /${ buildset_iso } .set) ; do
2015-02-09 23:48:29 +01:00
# [[ ! -f $prof/initsys ]] && break
check_profile " $prof "
2015-01-15 04:38:47 +01:00
cd $prof
2015-01-29 00:17:15 +01:00
load_profile " $prof "
2015-01-15 04:38:47 +01:00
build_profile
cd ..
done
2015-01-17 19:05:18 +01:00
msg3 " Finished building [ ${ buildset_iso } ] "
2015-01-15 04:38:47 +01:00
else
2015-02-09 23:48:29 +01:00
# [[ ! -f ${buildset_iso}/initsys ]] && die "${buildset_iso} is not a valid profile!"
check_profile " ${ buildset_iso } "
2015-01-29 07:24:30 +01:00
cd ${ buildset_iso }
2015-01-29 00:17:15 +01:00
load_profile " ${ buildset_iso } "
2015-01-15 04:38:47 +01:00
build_profile
cd ..
fi
}