make.sh new version
- script now more interactive - add sid repository for better testing support - spice better support - vmware demise - python2 end of life
This commit is contained in:
parent
8ab794bfea
commit
bf1819acfa
@ -2,7 +2,7 @@ sudo
|
|||||||
screen
|
screen
|
||||||
usbutils
|
usbutils
|
||||||
file
|
file
|
||||||
python2
|
#python2
|
||||||
python3
|
python3
|
||||||
python3-pip
|
python3-pip
|
||||||
genisoimage
|
genisoimage
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
qemu-guest-agent
|
qemu-guest-agent
|
||||||
spice-vdagent
|
spice-vdagent
|
||||||
open-vm-tools
|
xserver-xorg-video-qxl
|
||||||
|
#open-vm-tools
|
||||||
|
#xserver-xorg-video-vmware
|
||||||
|
263
make.sh
263
make.sh
@ -1,16 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
USER_HOME=$(eval echo ~${SUDO_USER})
|
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "Please run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
baseDir=$(pwd)
|
baseDir=$(pwd)
|
||||||
|
|
||||||
build=$baseDir/build
|
build=$baseDir/build
|
||||||
|
|
||||||
config=$baseDir/config
|
config=$baseDir/config
|
||||||
|
|
||||||
if [ "$EUID" -ne 0 ]
|
debian_version=$(lsb_release -sc 2>/dev/null)
|
||||||
then
|
|
||||||
echo "Please run as root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
pack_list=(live cli disk net firmware dm-common xfce4 cinnamon gui libreoffice vm)
|
pack_list=(live cli disk net firmware dm-common xfce4 cinnamon gui libreoffice vm)
|
||||||
|
|
||||||
@ -26,11 +30,24 @@ pack_forced=(live cli disk net firmware)
|
|||||||
|
|
||||||
pack_default=(dm-common xfce4 gui)
|
pack_default=(dm-common xfce4 gui)
|
||||||
|
|
||||||
|
|
||||||
|
nb_hooks=0
|
||||||
|
declare -a hook_checklist
|
||||||
|
for file in $config/hooks/live/*;
|
||||||
|
do
|
||||||
|
basename="$(basename -s ".hook.chroot" $file)"
|
||||||
|
hook_checklist+=($basename "" "ON")
|
||||||
|
((nb_hooks++))
|
||||||
|
#default all hook
|
||||||
|
hooks+="$basename "
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
-d use default pack
|
-d use default setings
|
||||||
-v Specifie Debian codename
|
-v force debian version
|
||||||
-o Specifie output folder
|
-o Specifie output folder
|
||||||
-i if set create iso instead of only squashfs
|
-i if set create iso instead of only squashfs
|
||||||
EOF
|
EOF
|
||||||
@ -56,13 +73,6 @@ _check()
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$debian_version" ]
|
|
||||||
then
|
|
||||||
printf "\e[31mPlease specifie Debian codename\e[0m\n"
|
|
||||||
_usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "$out" ]
|
if [ -d "$out" ]
|
||||||
then
|
then
|
||||||
printf "Write in \e[96m$out\e[0m folder\n"
|
printf "Write in \e[96m$out\e[0m folder\n"
|
||||||
@ -76,12 +86,23 @@ _check()
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Debian version of live system: \e[96m$debian_version\e[0m\n"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_choose()
|
_choose()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
RESULT=$(whiptail --title "Make debian live system" --inputbox "Specifie Debian codename" 10 70 $debian_version 3>&1 1>&2 2>&3)
|
||||||
|
[[ "$?" = 1 ]] && printf "\e[91mCancel\e[0m\n" && exit
|
||||||
|
|
||||||
|
debian_version=$RESULT
|
||||||
|
|
||||||
|
printf "Debian version of live system: \e[96m$debian_version\e[0m\n"
|
||||||
|
|
||||||
|
whiptail --title "Make debian live system" --yesno "Do you want to use sid ?" 7 70 --defaultno 3>&1 1>&2 2>&3
|
||||||
|
sid=$?
|
||||||
|
|
||||||
|
[[ $sid -eq 0 ]] && printf "Using \e[96msid\e[0m\\e[0m\n"
|
||||||
|
|
||||||
declare -a pack_checklist
|
declare -a pack_checklist
|
||||||
size=$((${#pack_list[@]}-(${#pack_forced[@]})))
|
size=$((${#pack_list[@]}-(${#pack_forced[@]})))
|
||||||
for pack in ${pack_list[@]}; do
|
for pack in ${pack_list[@]}; do
|
||||||
@ -99,17 +120,6 @@ _choose()
|
|||||||
printf "Pack list: \e[96m${pack[*]}\e[0m\n"
|
printf "Pack list: \e[96m${pack[*]}\e[0m\n"
|
||||||
|
|
||||||
|
|
||||||
nb_hooks=0
|
|
||||||
declare -a hook_checklist
|
|
||||||
for file in $config/hooks/live/*;
|
|
||||||
do
|
|
||||||
basename="$(basename -s ".hook.chroot" $file)"
|
|
||||||
hook_checklist+=($basename "" "ON")
|
|
||||||
((nb_hooks++))
|
|
||||||
done
|
|
||||||
|
|
||||||
#whiptail --separate-output --title "Make debian live system" --checklist "Select hooks to use" 15 70 ${nb_hooks} "${hook_checklist[@]}"
|
|
||||||
|
|
||||||
RESULT=$(whiptail --title "Make debian live system" --checklist "Select hooks to use" 15 70 ${nb_hooks} "${hook_checklist[@]}" 3>&1 1>&2 2>&3)
|
RESULT=$(whiptail --title "Make debian live system" --checklist "Select hooks to use" 15 70 ${nb_hooks} "${hook_checklist[@]}" 3>&1 1>&2 2>&3)
|
||||||
[[ "$?" = 1 ]] && printf "\e[91mCancel\e[0m\n" && exit
|
[[ "$?" = 1 ]] && printf "\e[91mCancel\e[0m\n" && exit
|
||||||
|
|
||||||
@ -117,14 +127,6 @@ _choose()
|
|||||||
|
|
||||||
printf "Hooks list: \e[96m${hooks[*]}\e[0m\n"
|
printf "Hooks list: \e[96m${hooks[*]}\e[0m\n"
|
||||||
|
|
||||||
# read -p "Continue ? " -n 1 -r
|
|
||||||
# echo
|
|
||||||
# if ! [[ $REPLY =~ ^[YyOo]$ ]]
|
|
||||||
# then
|
|
||||||
# echo "Cancel"
|
|
||||||
# exit
|
|
||||||
# fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_config()
|
_config()
|
||||||
@ -174,9 +176,104 @@ _build()
|
|||||||
lb bootstrap
|
lb bootstrap
|
||||||
[[ $? -eq 0 ]] || exit
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
|
#printf "\e[96mBuild live OS file system\e[0m\n"
|
||||||
|
#lb chroot
|
||||||
|
#[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
printf "\e[96mBuild live OS file system\e[0m\n"
|
printf "\e[96mBuild live OS file system\e[0m\n"
|
||||||
lb chroot
|
lb chroot_cache restore
|
||||||
[[ $? -eq 0 ]] || exit
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_prep install all mode-archives-chroot
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_devpts install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_proc install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_selinuxfs install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_sysfs install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_debianchroot install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_dpkg install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_tmpfs install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_sysv-rc install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_hosts install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_resolv install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_hostname install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_apt install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_archives chroot install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_linux-image
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_firmware
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_preseed
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_includes_before_packages
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
|
|
||||||
|
[[ $sid -eq 0 ]] && _sid
|
||||||
|
|
||||||
|
|
||||||
|
lb chroot_package-lists install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_install-packages install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_package-lists live
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_install-packages live
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_includes_after_packages
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_hooks
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_hacks
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_interactive
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_prep remove all mode-archives-chroot
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_archives chroot remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_apt remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_hostname remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_resolv remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_hosts remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_sysv-rc remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_tmpfs remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_dpkg remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_debianchroot remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_sysfs remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_selinuxfs remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_proc remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_devpts remove
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb chroot_cache save
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
|
|
||||||
|
[[ $sid -eq 0 ]] && echo "deb http://deb.debian.org/debian sid main" >> $build/chroot/etc/apt/sources.list
|
||||||
|
|
||||||
|
|
||||||
# Write commit hash and build date
|
# Write commit hash and build date
|
||||||
echo "$(git -C $baseDir log -1 --pretty='%cd %h %s' --date=format:"%F")" >> $build/chroot/etc/debian_version
|
echo "$(git -C $baseDir log -1 --pretty='%cd %h %s' --date=format:"%F")" >> $build/chroot/etc/debian_version
|
||||||
@ -184,7 +281,35 @@ _build()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_create_squashfs()
|
_sid()
|
||||||
|
{
|
||||||
|
printf "\e[96mAdd sid repository\e[0m\n"
|
||||||
|
echo "deb http://deb.debian.org/debian sid main" >> $build/chroot/etc/apt/sources.list.d/zz-sources.list
|
||||||
|
chroot $build/chroot apt update
|
||||||
|
|
||||||
|
cat <<EOF > $build/chroot/etc/apt/preferences.d/sid.pref
|
||||||
|
# testing pref :
|
||||||
|
|
||||||
|
# 100 <= P < 500: causes a version to be installed unless there is a
|
||||||
|
# version available belonging to some other distribution or the installed
|
||||||
|
# version is more recent
|
||||||
|
|
||||||
|
Package: *
|
||||||
|
Pin: release a=testing
|
||||||
|
Pin-Priority: 400
|
||||||
|
|
||||||
|
# unstable pref :
|
||||||
|
|
||||||
|
# 0 < P < 100: causes a version to be installed only if there is no
|
||||||
|
# installed version of the package
|
||||||
|
|
||||||
|
Package: *
|
||||||
|
Pin: release a=unstable
|
||||||
|
Pin-Priority: 50
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
_prep_mounts()
|
||||||
{
|
{
|
||||||
|
|
||||||
printf "\e[96mPreparing root filesystem\e[0m\n"
|
printf "\e[96mPreparing root filesystem\e[0m\n"
|
||||||
@ -198,24 +323,37 @@ _create_squashfs()
|
|||||||
|
|
||||||
# Configuring chroot
|
# Configuring chroot
|
||||||
lb chroot_prep install "${CHROOT_PREP_MOUNTS}"
|
lb chroot_prep install "${CHROOT_PREP_MOUNTS}"
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
lb chroot_prep install "${CHROOT_PREP_OTHER}" mode-apt-install-binary mode-archives-chroot
|
lb chroot_prep install "${CHROOT_PREP_OTHER}" mode-apt-install-binary mode-archives-chroot
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
lb chroot_archives chroot install
|
lb chroot_archives chroot install
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
printf "\e[96mBuilding root filesystem\e[0m\n"
|
}
|
||||||
lb binary_rootfs
|
|
||||||
|
|
||||||
printf "\e[96mPrepare images\e[0m\n"
|
_prep_umounts()
|
||||||
lb binary_linux-image
|
{
|
||||||
lb binary_syslinux
|
|
||||||
|
|
||||||
# Deconfiguring chroot
|
# Deconfiguring chroot
|
||||||
lb chroot_prep remove "${CHROOT_PREP_MOUNTS}"
|
lb chroot_prep remove "${CHROOT_PREP_MOUNTS}"
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
lb chroot_prep remove "${CHROOT_PREP_OTHER}"
|
lb chroot_prep remove "${CHROOT_PREP_OTHER}"
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_create_squashfs()
|
||||||
|
{
|
||||||
|
|
||||||
|
printf "\e[96mBuilding root filesystem\e[0m\n"
|
||||||
|
lb binary_rootfs
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb binary_linux-image
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
printf "\e[96mCopy filesystem\e[0m\n"
|
printf "\e[96mCopy filesystem\e[0m\n"
|
||||||
|
cp -v $build/chroot/{initrd.img,vmlinuz} $out/
|
||||||
cp $build/binary/live/{initrd.img,vmlinuz,filesystem.squashfs} $out/
|
cp -v $build/binary/live/filesystem.squashfs $out/
|
||||||
|
|
||||||
chown $SUDO_UID:$SUDO_GID $out/{initrd.img,vmlinuz,filesystem.squashfs}
|
chown $SUDO_UID:$SUDO_GID $out/{initrd.img,vmlinuz,filesystem.squashfs}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -223,21 +361,25 @@ _create_squashfs()
|
|||||||
_create_iso()
|
_create_iso()
|
||||||
{
|
{
|
||||||
|
|
||||||
printf "\e[96mBuild binary (live disc) images\e[0m\n"
|
printf "\e[96mPrepare image\e[0m\n"
|
||||||
lb binary
|
lb binary_syslinux
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb binary_grub_cfg
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
lb binary_grub-efi
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
printf "\e[96mCopy ISO\e[0m\n"
|
printf "\e[96mCreate image\e[0m\n"
|
||||||
|
lb binary_iso
|
||||||
|
[[ $? -eq 0 ]] || exit
|
||||||
|
|
||||||
if [ -d "$out" ]
|
printf "\e[96mCopy image\e[0m\n"
|
||||||
then
|
outiso="$out/live-${debian_version}-image.iso"
|
||||||
$out="$out/live-${debian_version}-image.iso"
|
cp -v $build/live-image-amd64.hybrid.iso $outiso
|
||||||
fi
|
chown $SUDO_UID:$SUDO_GID $outiso
|
||||||
|
|
||||||
cp $build/live-image-amd64.hybrid.iso $out
|
|
||||||
|
|
||||||
chown $SUDO_UID:$SUDO_GID $out
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_delete()
|
_delete()
|
||||||
{
|
{
|
||||||
printf "\e[96mDelete $build\e[0m\n"
|
printf "\e[96mDelete $build\e[0m\n"
|
||||||
@ -271,9 +413,12 @@ _config
|
|||||||
_build
|
_build
|
||||||
|
|
||||||
mkdir -p $build/chroot/etc/skel/.ssh
|
mkdir -p $build/chroot/etc/skel/.ssh
|
||||||
cp -v /home/lionel/.ssh/{config,key_rsa_majalis,key_rsa_majalis.pub} $build/chroot/etc/skel/.ssh
|
cp -v $USER_HOME/.ssh/{config,key_rsa_majalis,key_rsa_majalis.pub} $build/chroot/etc/skel/.ssh
|
||||||
sudo -u $SUDO_USER ssh-keygen -H -F netdldata.net > $build/chroot/etc/skel/.ssh/known_hosts
|
ssh-keygen -f $USER_HOME/.ssh/known_hosts -q -H -F netdldata.net > $build/chroot/etc/skel/.ssh/known_hosts
|
||||||
|
|
||||||
[[ $iso = true ]] && _create_iso || _create_squashfs
|
_prep_mounts
|
||||||
|
_create_squashfs
|
||||||
|
[[ $iso = true ]] && _create_iso
|
||||||
|
_prep_umounts
|
||||||
|
|
||||||
_delete
|
_delete
|
||||||
|
Loading…
x
Reference in New Issue
Block a user