From 4af27eb9c1b98722a3388fcd1e121a6cc09f8027 Mon Sep 17 00:00:00 2001 From: crims0n Date: Sat, 23 Jan 2021 17:05:51 +0300 Subject: [PATCH] support for default ubuntu boot --- autoinstall | 2 + linux-live/install_chroot | 3 +- linux-live/minioslib | 101 ++++++++++++++++---------------- linux-live/pkglists/ubuntu.list | 2 +- 4 files changed, 56 insertions(+), 52 deletions(-) diff --git a/autoinstall b/autoinstall index b793df7..91b20dd 100755 --- a/autoinstall +++ b/autoinstall @@ -41,6 +41,8 @@ create_completion create_backup +echo $LIVE_TYPE + # check number of args if [[ $# == 0 || $# > 3 ]]; then help; fi diff --git a/linux-live/install_chroot b/linux-live/install_chroot index 3ec3f32..8746992 100644 --- a/linux-live/install_chroot +++ b/linux-live/install_chroot @@ -8,9 +8,10 @@ SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" set +u if [ -z $OUTPUT ]; then - . $SCRIPT_DIR/buildconfig || exit 1 + . $SCRIPT_DIR/buildconfig || exit 1 fi set -u + . $SCRIPT_DIR/minioslib || exit 1 . $SCRIPT_DIR/config || exit 1 diff --git a/linux-live/minioslib b/linux-live/minioslib index 7250bd8..22aea37 100644 --- a/linux-live/minioslib +++ b/linux-live/minioslib @@ -551,7 +551,8 @@ function preserve_environment_variables() { CREATE_BACKUP=$CREATE_BACKUP \ DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ APT_CMD=$APT_CMD \ - APT_OPTIONS=$APT_OPTIONS + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE fi } @@ -592,7 +593,8 @@ function build_chroot() { CREATE_BACKUP=$CREATE_BACKUP \ DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ APT_CMD=$APT_CMD \ - APT_OPTIONS=$APT_OPTIONS /linux-live/install_chroot - + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE /linux-live/install_chroot - else chroot $BUILD_DIR /linux-live/install_chroot - fi @@ -618,7 +620,7 @@ function build_live() { remove_log_file - if [ LIVE_TYPE = "linux-live" ]; then + if [ $LIVE_TYPE = "linux-live" ]; then copy_build_scripts check_build_dir @@ -636,12 +638,13 @@ EOF' CREATE_BACKUP=$CREATE_BACKUP \ DEBIAN_FRONTEND_TYPE=$DEBIAN_FRONTEND_TYPE \ APT_CMD=$APT_CMD \ - APT_OPTIONS=$APT_OPTIONS /linux-live/build + APT_OPTIONS=$APT_OPTIONS \ + LIVE_TYPE=$LIVE_TYPE /linux-live/build else chroot $BUILD_DIR /linux-live/build fi chroot $BUILD_DIR umount /proc - elif [ LIVE_TYPE = "ubuntu" ]; then + elif [ $LIVE_TYPE = "ubuntu" ]; then rm -rf $BUILD_DIR/linux-live rm -rf $PARENT_DIR/image mkdir -p $PARENT_DIR/image/{casper,isolinux,install} @@ -651,11 +654,11 @@ EOF' sudo cp $BUILD_DIR/boot/initrd.img-**-**-generic $PARENT_DIR/image/casper/initrd # memtest86 - sudo cp $BUILD_DIR/boot/memtest86+.bin image/install/memtest86+ + #sudo cp $BUILD_DIR/boot/memtest86+.bin image/install/memtest86+ - wget --progress=dot https://www.memtest86.com/downloads/memtest86-usb.zip -O $PARENT_DIR/image/install/memtest86-usb.zip - unzip -p $PARENT_DIR/image/install/memtest86-usb.zip memtest86-usb.img >$PARENT_DIR/image/install/memtest86 - rm -f $PARENT_DIR/image/install/memtest86-usb.zip + #wget --progress=dot https://www.memtest86.com/downloads/memtest86-usb.zip -O $PARENT_DIR/image/install/memtest86-usb.zip + #unzip -p $PARENT_DIR/image/install/memtest86-usb.zip memtest86-usb.img >$PARENT_DIR/image/install/memtest86 + #rm -f $PARENT_DIR/image/install/memtest86-usb.zip # grub touch $PARENT_DIR/image/ubuntu @@ -676,18 +679,7 @@ menuentry "Check disc for defects" { linux /casper/vmlinuz boot=casper integrity-check quiet splash --- initrd /casper/initrd } -menuentry "Test memory Memtest86+ (BIOS)" { - linux16 /install/memtest86+ -} -menuentry "Test memory Memtest86 (UEFI, long load time)" { - insmod part_gpt - insmod search_fs_uuid - insmod chain - loopback loop /install/memtest86 - chainloader (loop,gpt1)/efi/boot/BOOTX64.efi -} EOF - # generate manifest sudo chroot $BUILD_DIR dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee $PARENT_DIR/image/casper/filesystem.manifest sudo cp -v $PARENT_DIR/image/casper/filesystem.manifest $PARENT_DIR/image/casper/filesystem.manifest-desktop @@ -703,7 +695,7 @@ EOF # create diskdefines cat <$PARENT_DIR/image/README.diskdefines -#define DISKNAME $SYSTEMNAME $VER +#define DISKNAME $SYSTEMNAME $SYSTEMVER #define TYPE binary #define TYPEbinary 1 #define ARCH $DISTRIBUTION_ARCH @@ -759,7 +751,7 @@ function build_iso() { check_build_dir - if [ LIVE_TYPE = "linux-live" ]; then + if [ $LIVE_TYPE = "linux-live" ]; then copy_build_scripts @@ -830,11 +822,11 @@ function build_iso() { fi fi exit 0 - elif [ LIVE_TYPE = "ubuntu" ]; then + elif [ $LIVE_TYPE = "ubuntu" ]; then VER=$SYSTEMVER DATE=$(date +%Y%m%d_%H%M) ISO=$ISO_DIR/$LIVEKITNAME-$DISTRIBUTION-$DISTRIBUTION_ARCH-$COMP_TYPE-$DATE.iso - cd $BUILD_DIR/image + cd $PARENT_DIR/image sudo xorriso \ -as mkisofs \ -iso-level 3 \ @@ -963,14 +955,14 @@ function main_pkg_list() { $APT_CMD update >>$OUTPUT 2>&1 && $APT_CMD install $APT_OPTIONS ubuntu-minimal resolvconf xz-utils linux-image-generic >>$OUTPUT 2>&1 fi -if [ $LIVE_TYPE = "ubuntu"]; then -if [ -f $SCRIPT_DIR/pkglists/ubuntu.list ]; then - sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ - $APT_CMD update >>$OUTPUT 2>&1 && - $APT_CMD install $APT_OPTIONS \ - $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu.list | tr "\n" " ") >>$OUTPUT 2>&1 -fi -fi + if [ $LIVE_TYPE = "ubuntu" ]; then + if [ -f $SCRIPT_DIR/pkglists/ubuntu.list ]; then + sudo DEBIAN_FRONTEND=$DEBIAN_FRONTEND_TYPE \ + $APT_CMD update >>$OUTPUT 2>&1 && + $APT_CMD install $APT_OPTIONS \ + $(grep -vE "^\s*#" $SCRIPT_DIR/pkglists/ubuntu.list | tr "\n" " ") >>$OUTPUT 2>&1 + fi + fi } function other_pkg_list() { @@ -990,6 +982,13 @@ function chroot_pkg_install() { other_pkg_list + if [ $LIVE_TYPE = "ubuntu" ]; then + $APT_CMD install $APT_OPTIONS tasksel >>$OUTPUT 2>&1 + tasksel install xubuntu-minimal >>$OUTPUT 2>&1 + $APT_CMD install $APT_OPTIONS ubiquity ubiquity-casper ubiquity-frontend-gtk language-pack-gnome-ru language-pack-gnome-en >>$OUTPUT 2>&1 + $APT_CMD install $APT_OPTIONS mousepad blueman ristretto onboard gigolo gparted xfce4-taskmanager + fi + # configure console and keyboard cat </etc/default/console-setup # CONFIGURATION FILE FOR SETUPCON @@ -1048,18 +1047,19 @@ EOF function chroot_configure() { current_process + if [ $LIVE_TYPE = "linux-live" ]; then - echo "Set up password for user 'root'" >>$OUTPUT 2>&1 - echo root:toor | chpasswd >>$OUTPUT 2>&1 + echo "Set up password for user 'root'" >>$OUTPUT 2>&1 + echo root:toor | chpasswd >>$OUTPUT 2>&1 - echo "Set up user 'live'" >>$OUTPUT 2>&1 - adduser --gecos '' live --disabled-password >>$OUTPUT 2>&1 - echo "Set up password for user 'live'" >>$OUTPUT 2>&1 - echo live:evil | chpasswd >>$OUTPUT 2>&1 + echo "Set up user 'live'" >>$OUTPUT 2>&1 + adduser --gecos '' live --disabled-password >>$OUTPUT 2>&1 + echo "Set up password for user 'live'" >>$OUTPUT 2>&1 + echo live:evil | chpasswd >>$OUTPUT 2>&1 - if grep openssh-server $SCRIPT_DIR/pkglists/main.list >>$OUTPUT 2>&1 || grep openssh-server $SCRIPT_DIR/pkglists/other.list >>$OUTPUT 2>&1; then - echo "Enable ssh.service autostart." >>$OUTPUT 2>&1 - cat </lib/systemd/system/ssh-keygen.service + if grep openssh-server $SCRIPT_DIR/pkglists/main.list >>$OUTPUT 2>&1 || grep openssh-server $SCRIPT_DIR/pkglists/other.list >>$OUTPUT 2>&1; then + echo "Enable ssh.service autostart." >>$OUTPUT 2>&1 + cat </lib/systemd/system/ssh-keygen.service [Unit] Description=Generate sshd keys Before=ssh.service @@ -1073,13 +1073,13 @@ StandardOutput=journal [Install] WantedBy=multi-user.target EOF - systemctl enable ssh-keygen >>$OUTPUT 2>&1 - systemctl enable ssh >>$OUTPUT 2>&1 + systemctl enable ssh-keygen >>$OUTPUT 2>&1 + systemctl enable ssh >>$OUTPUT 2>&1 - fi + fi - echo "Enable dhclient.service autostart." >>$OUTPUT 2>&1 - cat </lib/systemd/system/dhclient.service + echo "Enable dhclient.service autostart." >>$OUTPUT 2>&1 + cat </lib/systemd/system/dhclient.service [Unit] Description=DHCP Client Documentation=man:dhclient(8) @@ -1097,11 +1097,12 @@ PIDFile=/run/dhclient.pid WantedBy=multi-user.target WantedBy=network-online.target EOF - systemctl enable dhclient >>$OUTPUT 2>&1 + systemctl enable dhclient >>$OUTPUT 2>&1 - if [ -f /etc/systemd/system/multi-user.target.wants/grub-initrd-fallback.service ]; then - echo "Disable grub-initrd-fallback.service autostart." >>$OUTPUT 2>&1 - systemctl disable grub-initrd-fallback.service >>$OUTPUT 2>&1 + if [ -f /etc/systemd/system/multi-user.target.wants/grub-initrd-fallback.service ]; then + echo "Disable grub-initrd-fallback.service autostart." >>$OUTPUT 2>&1 + systemctl disable grub-initrd-fallback.service >>$OUTPUT 2>&1 + fi fi } diff --git a/linux-live/pkglists/ubuntu.list b/linux-live/pkglists/ubuntu.list index 43be80c..14eb698 100644 --- a/linux-live/pkglists/ubuntu.list +++ b/linux-live/pkglists/ubuntu.list @@ -3,7 +3,7 @@ lupin-casper discover laptop-detect os-prober -#network-manager +network-manager #resolvconf net-tools wireless-tools