Update make.sh

- fix KERNEL_PARAM
 - remove android
 - Add printf description
 - fix build parallel mksquashfs with mount in chroot
 - remove old stuff
This commit is contained in:
Lionel 2021-09-10 21:26:09 +02:00
parent 6722033e46
commit 95cc79dd78

82
make.sh
View File

@ -21,7 +21,6 @@ _usage()
-x Make xfce live image -x Make xfce live image
-c Make cinnamon live image -c Make cinnamon live image
-v Make xfce-vm live image -v Make xfce-vm live image
-a Make live image for android
EOF EOF
} }
@ -33,8 +32,6 @@ fi
KERNEL_PARAM="boot=live components lang=fr_FR.UTF-8 locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-model=pc105 timezone=Europe/Paris utc=yes" KERNEL_PARAM="boot=live components lang=fr_FR.UTF-8 locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-model=pc105 timezone=Europe/Paris utc=yes"
keep_iso="true"
pack_full=(live cli firmware xfce4 gui cinnamon gui_opt) pack_full=(live cli firmware xfce4 gui cinnamon gui_opt)
pack_xfce=(live cli firmware xfce4 gui) pack_xfce=(live cli firmware xfce4 gui)
@ -52,10 +49,6 @@ _config()
cd $build cd $build
#cp -r $config/auto $build/auto
sed -i 's:\(--bootappend-live\).*:\1 "'"$KERNEL_PARAM"'":' $build/auto/config
ln -sr $config/includes.chroot $build/config/includes.chroot ln -sr $config/includes.chroot $build/config/includes.chroot
ln -sr $config/packages.chroot $build/config/packages.chroot ln -sr $config/packages.chroot $build/config/packages.chroot
@ -75,7 +68,7 @@ _config()
--source false \ --source false \
--backports false \ --backports false \
--memtest none \ --memtest none \
--bootappend-live "boot=live components lang=fr_FR.UTF-8 locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-model=pc105 timezone=Europe/Paris utc=yes" \ --bootappend-live "$KERNEL_PARAM"
rm $build/config/package-lists/* rm $build/config/package-lists/*
@ -90,8 +83,10 @@ _config()
_build() _build()
{ {
#time nice -20 ionice -c 1 lb build printf "\e[96mBootstrap new root filesystem\e[0m\n"
lb bootstrap lb bootstrap
printf "\e[96mBuild live OS file system\e[0m\n"
lb chroot lb chroot
} }
@ -99,11 +94,32 @@ _build()
_create_squashfs() _create_squashfs()
{ {
printf "\e[96mPreparing root filesystem\e[0m\n"
lb binary_chroot lb binary_chroot
# Chroot preparation component lists
# We deliberately exclude 'debianchroot'
CHROOT_PREP_MOUNTS="devpts proc selinuxfs sysfs"
CHROOT_PREP_OTHER="dpkg tmpfs sysv-rc hosts resolv hostname apt"
# Configuring chroot
lb chroot_prep install "${CHROOT_PREP_MOUNTS}"
lb chroot_prep install "${CHROOT_PREP_OTHER}" mode-apt-install-binary mode-archives-chroot
lb chroot_archives chroot install
printf "\e[96mBuilding root filesystem\e[0m\n"
lb binary_rootfs lb binary_rootfs
printf "\e[96mPrepare images\e[0m\n"
lb binary_linux-image lb binary_linux-image
lb binary_syslinux lb binary_syslinux
# Deconfiguring chroot
lb chroot_prep remove "${CHROOT_PREP_MOUNTS}"
lb chroot_prep remove "${CHROOT_PREP_OTHER}"
printf "\e[96mCopy filesystem\e[0m\n"
out="$iso/$type" out="$iso/$type"
install -d -m 0755 -o $SUDO_UID -g $SUDO_GID $out install -d -m 0755 -o $SUDO_UID -g $SUDO_GID $out
@ -112,18 +128,16 @@ _create_squashfs()
chown $SUDO_UID:$SUDO_GID $out/{initrd.img,vmlinuz,filesystem.squashfs} chown $SUDO_UID:$SUDO_GID $out/{initrd.img,vmlinuz,filesystem.squashfs}
lb chroot_sysfs remove
lb chroot_selinuxfs remove
lb chroot_proc remove
lb chroot_devpts remove
} }
_create_iso() _create_iso()
{ {
printf "\e[96mBuild binary (live disc) images\e[0m\n"
lb binary lb binary
printf "\e[96mCopy ISO\e[0m\n"
out="$iso/$type" out="$iso/$type"
install -d -m 0755 -o $SUDO_UID -g $SUDO_GID $out install -d -m 0755 -o $SUDO_UID -g $SUDO_GID $out
@ -133,37 +147,17 @@ _create_iso()
chown $SUDO_UID:$SUDO_GID $out/live-${type}-image.iso chown $SUDO_UID:$SUDO_GID $out/live-${type}-image.iso
} }
_extract()
{
cd $out
7z e live-${type}-image.iso live/{initrd.img,vmlinuz,filesystem.squashfs}
chown $SUDO_UID:$SUDO_GID . -R
rm live-${type}-image.iso
}
_delete() _delete()
{ {
echo "Delete $build" printf "\e[96mDelete $build\e[0m\n"
# read -p "You sure ? " -n 1 -r
# echo
# if [[ $REPLY =~ ^[YyOo]$ ]]
# then
rm -r $build rm -r $build
# else
# echo "Cancel"
# fi
} }
while getopts "fxcva" OPTION; do while getopts "fxcv" OPTION; do
case $OPTION in case $OPTION in
f) f)
type="full" type="full"
printf "\e[96mMake $type\e[0m\n"
_config _config
_build _build
_create_squashfs _create_squashfs
@ -171,6 +165,7 @@ while getopts "fxcva" OPTION; do
;; ;;
x) x)
type="xfce" type="xfce"
printf "\e[96mMake $type\e[0m\n"
_config _config
_build _build
mkdir -p $build/chroot/etc/skel/.ssh mkdir -p $build/chroot/etc/skel/.ssh
@ -181,6 +176,7 @@ while getopts "fxcva" OPTION; do
;; ;;
v) v)
type="vmxfce" type="vmxfce"
printf "\e[96mMake $type\e[0m\n"
_config _config
_build _build
_create_iso _create_iso
@ -188,22 +184,12 @@ while getopts "fxcva" OPTION; do
;; ;;
c) c)
type="cinnamon" type="cinnamon"
printf "\e[96mMake $type\e[0m\n"
_config _config
_build _build
_create_iso _create_iso
_delete _delete
;; ;;
a)
type="android"
KERNEL_PARAM+=" toram x-session-manager=/usr/bin/cinnamon-session"
_config
_build
mkdir -p $build/chroot/etc/skel/.ssh
cp /home/lionel/.ssh/{config,key_rsa_majalis,key_rsa_majalis.pub} $build/chroot/etc/skel/.ssh
ssh-keygen -H -F netdldata.net > $build/chroot/etc/skel/.ssh/known_hosts
_create_iso
_delete
;;
*) *)
_usage _usage
exit 1 exit 1