From eb892d10b2705d87458179c3ea44531308521d06 Mon Sep 17 00:00:00 2001 From: codekoch Date: Tue, 29 Jan 2019 15:40:54 +0100 Subject: [PATCH] scipts added --- README | 18 +++++----- build | 2 ++ scripts/.createBootDevice.sh.swp | Bin 0 -> 1024 bytes scripts/createBootDevice.sh | 59 +++++++++++++++++++++++-------- 4 files changed, 56 insertions(+), 23 deletions(-) create mode 100644 scripts/.createBootDevice.sh.swp mode change 100644 => 100755 scripts/createBootDevice.sh diff --git a/README b/README index 0b7e6b8..9b24252 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Linux Live Kit ============== Use this set of scripts to turn your existing preinstalled Linux -distribution into a Live Kit (formely known as Live CD). +distribution into a Live Kit (formely known as Live CD or Live USB Stick). Make sure to extract and use it on a posix-compatible filesystem, since it creates some (sym)links and such. @@ -14,7 +14,7 @@ Note: Be warned, if you put it to /tmp, some distros may erase it on reboot. * Before you start building your Kit, edit the file ./config - Most importantly change the LIVEKITNAME variable. + Most importantly change the LIVEKITNAME variable and the LIVEKITDATA path. * Make sure your kernel is in /boot/vmlinuz or change the path in ./config Your kernel must support squashfs and aufs. Debian Jessie's kernel does. @@ -35,18 +35,20 @@ Note: isolinux sources, patching them using your actual LIVEKITNAME and recompiling. This step is not needed if you plan to boot from USB only. -* If you have tmpfs mounted on /tmp, make sure you have enough RAM +* Make sure you have enough RAM on the given LIVEKITDATA path since LiveKit will store lots of data there. If you are low on RAM, - make sure /tmp is a regular on-disk directory. + make sure LIVEKITDATA is a regular on-disk directory. * When done, run the ./build script to create your Live Kit - - it will create ISO and TAR files for you in /tmp - - make sure you have enough free space in /tmp to handle it * You will need the following packages to be installed: - squashfs-tools - genisoimage or mkisofs - zip - -Author: Tomas M. +* After the successful build you will find your livelinux system under the path + given by LIVEKITDATA + +* to create a bootable device you can use the script createBootDevice.,sh un der scripts + +Author: Tomas M. and Olaf Koch diff --git a/build b/build index fb82827..6ece81d 100755 --- a/build +++ b/build @@ -48,6 +48,7 @@ BOOT="$LIVEKITDATA"/"$LIVEKITNAME"/boot mkdir -p "$BOOT" mkdir -p "$BOOT"/../changes mkdir -p "$BOOT"/../modules +mkdir -p "$BOOT"/../scripts if [ "$INITRAMFS" != "" ]; then mv "$INITRAMFS" $BOOT/initrfs.img @@ -57,6 +58,7 @@ cp bootfiles/* $BOOT cat bootfiles/syslinux.cfg | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" > $BOOT/syslinux.cfg cat bootfiles/bootinst.bat | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" | sed -r "s:\\\\boot\\\\:\\\\$LIVEKITNAME\\\\boot\\\\:" > $BOOT/bootinst.bat cp $VMLINUZ $BOOT/vmlinuz +cp scripts/* $BOOT/../scripts # create compressed 01-core.sb COREFS="" diff --git a/scripts/.createBootDevice.sh.swp b/scripts/.createBootDevice.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..f4385b5415f7807b4cd7c7ee897b8bc4c626eace GIT binary patch literal 1024 zcmYc?$V<%2S1{7E)H7y40<|0r4Efpl$r(suxR_vdx~{SyHV zrs{)L>*r*arRHSjl~(8%Cl_TFloabH7o{eaq&ns2m$;;sWhSTU6%%7OR*OajM?+vV L1h9obD7qj3ZK59G literal 0 HcmV?d00001 diff --git a/scripts/createBootDevice.sh b/scripts/createBootDevice.sh old mode 100644 new mode 100755 index fddef50..e108864 --- a/scripts/createBootDevice.sh +++ b/scripts/createBootDevice.sh @@ -1,25 +1,54 @@ #!/bin/bash # script by Olaf Koch 3.11.2018 -### settings -dev=$1 -liveimagename="mediakit" -squashfilesystem="/run/initramfs/memory/data" -if [ -e /run/initramfs/memory/data/vmlinuz ]; then - kernelfile="/run/initramfs/memory/data/vmlinuz" -else - kernelfile="/run/initramfs/memory/data/mediakit/boot/vmlinuz" -fi -if [ -e /run/initramfs/memory/data/initrfs.img ]; then - initrfsfile="/run/initramfs/memory/data/initrfs.img" -else - initrfsfile="/run/initramfs/memory/data/mediakit/boot/initrfs.img" + +if [[ ${EUID} -ne 0 ]]; then + echo "this script must be executed with elevated privileges" + exit 1 fi +# get other disks +mapfile -t info < <( lsblk ) + +i=1 +for entry in "${info[@]}" +do + if [[ `echo "$entry" | awk '{ print $6}'` == "disk" ]]; then + echo -e "\033[43m $i \e[0m" $entry + devices[$i]=`echo "$entry" | awk '{ print $1}'` + i=`expr $i + 1` + fi +done + +tput setaf 11 +echo "Please select the disknumber of the destination device: (All data on this device will be destroyed!)" +tput sgr0 +read destination +destinationpath="/dev/${devices[$destination]}" + +dev=$destinationpath +cd .. +liveimagename=`echo "${PWD##*/}"` +cd .. +squashfilesystem=`echo "${PWD}"` +kernelfile="${squashfilesystem}/${liveimagename}/boot/vmlinuz" +initrfsfile="${squashfilesystem}/${liveimagename}/boot/initrfs.img" + +### +tput setaf 11 +echo "Copy $liveimagename to $destinationpath..." +echo "Settings:" +echo "liveimagename=$liveimagename" +echo "squashfilesystem=$squashfilesystem" +echo "kernelfile=$kernelfile" +echo "initrfsfile=$initrfsfile" +echo "(Enter to continue/STRG-C to abort)" +tput sgr0 +read +exit + ### - - if [[ ${EUID} -ne 0 ]]; then echo "this script must be executed with elevated privileges" exit 1