medium change set
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
.config
|
.config
|
||||||
|
cache/*
|
||||||
|
images/*
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
Linux Live Framework
|
Linux Live Framework
|
||||||
======================
|
====================
|
||||||
|
|
||||||
This project is for supporting many CPUs architectures & extended functions unlike Linux-Live Kit (https://github.com/Tomas-M/linux-live)
|
This project is for supporting many CPUs architectures & extended functions unlike Linux-Live Kit (https://github.com/Tomas-M/linux-live)
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,37 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
. initrd/functions
|
|
||||||
set -eET -o pipefail
|
|
||||||
exec > >(tee -i /tmp/llf.log) 2>&1
|
|
||||||
cd "$(dirname $(readlink -f ${0}))"
|
cd "$(dirname $(readlink -f ${0}))"
|
||||||
cp -f $([ ${V} ]&&echo ${V}) config .config
|
exec > >(tee -i /tmp/llf.log) 2>&1
|
||||||
for i in mksquashfs cpio gzip sed grep xorriso tar find file; do
|
#trap 'echo $(basename ${BASH_SOURCE[0]}):${LINENO}: "${BASH_COMMAND}"' DEBUG
|
||||||
if [ ! -x "$(command -v ${i})" ]; then
|
set -eET -o pipefail
|
||||||
|
. initrd/functions||true
|
||||||
|
for i in mksquashfs cpio gzip sed grep xorriso tar find file grub-mkrescue; do
|
||||||
|
if [ ! -x "$(type -P ${i})" ]; then
|
||||||
|
progsNotFound+=(${i})
|
||||||
case ${i} in
|
case ${i} in
|
||||||
mksquashfs) a="squashfs-tools";;
|
mksquashfs) a="squashfs-tools";;
|
||||||
readelf) a="binutils";;
|
readelf) a="binutils";;
|
||||||
find) a="find-utils";;
|
find) a="find-utils";;
|
||||||
|
grub-mkrescue) a="grub2";;
|
||||||
*) a="${i}"
|
*) a="${i}"
|
||||||
esac
|
esac
|
||||||
echo "Please install ${a} package to run this tool"
|
echo "Please install ${a} package"
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
local DATA ret tmpRoot utc v krnV
|
local DATA ret tmpRoot utc v krnV
|
||||||
echo "KERNEL=\"${kernel}}\"" >>.config
|
|
||||||
echo "LMK=\"/lib/modules/\"" >>.config
|
|
||||||
krnV="$(file -bL ${kernel} | grep -o 'version .*' | cut -d' ' -f2)"
|
krnV="$(file -bL ${kernel} | grep -o 'version .*' | cut -d' ' -f2)"
|
||||||
top="${PWD}"
|
top="${PWD}"
|
||||||
INITRAMFS="${workTmpDir}/initRd"
|
INITRAMFS="${workTmpDir}/initRd"
|
||||||
DATA="${workTmpDir}/isoImage"
|
DATA="${workTmpDir}/isoImage"
|
||||||
env DATA="${DATA}" INITRAMFS="${INITRAMFS}" V="${V}" top="${top}" initrd/create
|
cat <<eot >>.config
|
||||||
|
KERNEL='$(readlink -f ${kernel})'
|
||||||
|
LMK='/lib/modules/${krnV}'
|
||||||
|
eot
|
||||||
|
env INITRAMFS="${INITRAMFS}" V="${V}" top="${top}" LMK="/lib/modules/${krnV}" initrd/create||true
|
||||||
ret="${?}"
|
ret="${?}"
|
||||||
tmpRoot="${workTmpDir}/tmpRoot"
|
tmpRoot="${workTmpDir}/tmpRoot"
|
||||||
mkdir -p $([ ${V} ]&&echo ${V}) ${DATA}/changes ${DATA}/os/modules
|
mkdir -p $([ ${V} ]&&echo ${V}) ${DATA}/changes ${DATA}/os/modules
|
||||||
@@ -52,7 +57,7 @@ main()
|
|||||||
cp -f $([ ${V} ]&&echo ${V}) ${KERNEL} ${DATA}/vmlinuz
|
cp -f $([ ${V} ]&&echo ${V}) ${KERNEL} ${DATA}/vmlinuz
|
||||||
cd ${DATA}
|
cd ${DATA}
|
||||||
utc="$(date +%s)"
|
utc="$(date +%s)"
|
||||||
v="$(git -C ${top} rev-parse HEAD 2>/dev/null|tr [:lower:] [:upper:]):$(git -C ${top} branch --show-current 2>/dev/null|tr [:lower:] [:upper:]):GIT"||v="INFINITY:PRIVATE:LOCAL"
|
v="$(git -C ${top} rev-parse HEAD 2>/dev/null|tr [:lower:] [:upper:]):$(git -C ${top} branch --show-current 2>/dev/null|tr [:lower:] [:upper:]):GIT"||true;v="INFINITY:PRIVATE:LOCAL"
|
||||||
cat <<eot >.LlfMeta
|
cat <<eot >.LlfMeta
|
||||||
# Built using Linux-Live-Framework technology.
|
# Built using Linux-Live-Framework technology.
|
||||||
LLF_NAME="${DISTRO}"
|
LLF_NAME="${DISTRO}"
|
||||||
@@ -61,41 +66,48 @@ LLF_UTC="${utc}"
|
|||||||
eot
|
eot
|
||||||
[[ ${ret} = 2 ]]&&echo "LLF_ELF_STATIC_INITRD=\"y\"" >>.LlfMeta||echo "LLF_ELF_STATIC_INITRD=\"n\"" >>.LlfMeta
|
[[ ${ret} = 2 ]]&&echo "LLF_ELF_STATIC_INITRD=\"y\"" >>.LlfMeta||echo "LLF_ELF_STATIC_INITRD=\"n\"" >>.LlfMeta
|
||||||
grub-mkrescue $([ ${V} ]&&echo ${V}) -o /${DISTRO}-${utc}.iso --compress=xz --product-name="${DISTRO}" --product-version="v=${v} t=${UTC}" .
|
grub-mkrescue $([ ${V} ]&&echo ${V}) -o /${DISTRO}-${utc}.iso --compress=xz --product-name="${DISTRO}" --product-version="v=${v} t=${UTC}" .
|
||||||
|
mv -f /${DISTRO}-${utc}.iso ${top}/images/${DISTRO}-${utc}.iso
|
||||||
#xorriso -as mkisofs -o /${DISTRO}-${utc}.iso -iso-level 3 -J -R -D -A ${DISTRO} -V ${DISTRO} -no-emul-boot -boot-info-table -boot-load-size 2 -b isolinux.bin -c boot/grub/grub.cat -eltorito-alt-boot -e /efi.img -no-emul-boot .
|
#xorriso -as mkisofs -o /${DISTRO}-${utc}.iso -iso-level 3 -J -R -D -A ${DISTRO} -V ${DISTRO} -no-emul-boot -boot-info-table -boot-load-size 2 -b isolinux.bin -c boot/grub/grub.cat -eltorito-alt-boot -e /efi.img -no-emul-boot .
|
||||||
#isohybrid --version >/dev/null 2>&1&&isohybrid -u /${DISTRO}-${utc}.iso
|
#isohybrid --version >/dev/null 2>&1&&isohybrid -u /${DISTRO}-${utc}.iso
|
||||||
}
|
}
|
||||||
selectKernel()
|
selectKernel()
|
||||||
{
|
{
|
||||||
local checkbox_output list krn
|
local checkbox_output list
|
||||||
mapfile -t list < <(find /boot -type f|egrep"bzImage|kernel|vmlinuz" 2>/dev/null|egrep -v "init|$.old"|sort -n)
|
mapfile -t list < <(find /boot -type f|egrep "bzImage|kernel|vmlinuz" 2>/dev/null|egrep -v "init|.*.old$"|sort -rn)
|
||||||
if [ ${#list[@]} -gt 1 ]; then
|
if [ ${#list[@]} -gt 1 ]; then
|
||||||
. ext/checkbox/checkbox.sh checkbox.sh --message="Please choose your kernel version to proceed:" --index --options="$(for i in "${list[@]}"; do basename "${i}";done;)"
|
. ext/checkbox/checkbox.sh --message="Please choose your kernel version to proceed:" --index --options="$(for i in "${list[@]}"; do basename "${i}";done;)"
|
||||||
krn="/boot/${list[${checkbox_output}]}"
|
kernel="${list[${checkbox_output}]}"
|
||||||
else
|
else
|
||||||
krn="${list[0]}"
|
kernel="${list[0]}"
|
||||||
fi
|
fi
|
||||||
kernel="${krn}"
|
|
||||||
export kernel
|
export kernel
|
||||||
}
|
}
|
||||||
declare -g kernel DISTRO workTmpDir V setCompatFlags
|
validArgs="$(getopt --name "${0}" --options 'i::k:d:w:CDnv' --longoptions 'interactive,,kernel:,distro:,workdir:,clean,debug,dry-run,verbose' -- "$@")"
|
||||||
for i; do
|
[[ ${?} -ne 0 ]]&&false
|
||||||
case ${i} in
|
eval set -- "${validArgs}"
|
||||||
|
while :; do
|
||||||
|
case ${1} in
|
||||||
-i|--interactive) helper=true ;;
|
-i|--interactive) helper=true ;;
|
||||||
-k|--kernel) kernel="${2}"; shift ;;
|
-k|--kernel) kernel="${2}"; shift ;;
|
||||||
-d|--distro) DISTRO="${2}"; shift ;;
|
-d|--distro) DISTRO="${2}"; shift ;;
|
||||||
-w|--workdir) workTmpDir="${2}"; shift ;;
|
-w|--workdir) workTmpDir="${2}"; shift ;;
|
||||||
-D|--debug) set -x; setCompatFlags+=" -x " ;;
|
-D|--debug) set -x ;;
|
||||||
-n|--dry-run) set -n; setCompatFlags+=" -n " ;;
|
-n|--dry-run) set -nv ;;
|
||||||
-v|--verbose) set -v; V="-v" ;;
|
-v|--verbose) set -v ;;
|
||||||
-C|--clean) clean=true ;;
|
-C|--clean) clean=true ;;
|
||||||
--) shift; break ;;
|
--) shift; break ;;
|
||||||
*) echo "Unknown option: ${i}"; exit 1 ;;
|
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
trap '. initrd/functions&&[[ ${clean} ]]&& { m A "\nCleaning-up";if rp "rm -rf ${workTmpDir}";then m i "Done!\n";else m w "Failed!\n";fi; };exit ${?}' HUP INT QUIT ILL TRAP ABRT TERM
|
#shift $((OPTIND-1))
|
||||||
[[ -t 0 && ${helper} || ${helper} ]]&&if selectKernel&&main; then true else; false; fi
|
export SHELLOPTS
|
||||||
[[ -e ${kernel} ]]||m e "Kernel not found: ${kernel}\n"&&false
|
cp -f config .config
|
||||||
|
export V setCompatFlags clean
|
||||||
|
trap '. initrd/functions 2>/dev/null;[[ ${clean} ]]&& { m A "\nCleaning-up";if rp f "rm -rf ${workTmpDir}";then m i "\nDone!\n";else m w "\nFailed!\n";fi; };reset;exit ${?}' QUIT EXIT INT TERM
|
||||||
|
[[ ${helper} ]]&&selectKernel
|
||||||
[[ -z ${DISTRO} ]]&&. .config&&m w "DISTRO not set. Using defaults: ${DISTRO}\n"||true
|
[[ -z ${DISTRO} ]]&&. .config&&m w "DISTRO not set. Using defaults: ${DISTRO}\n"||true
|
||||||
workTmpDir="${workTmpDir:-$(mktemp -d /tmp/Llf_WorkDir_XXXXXXX)}"||true
|
workTmpDir="${workTmpDir:-$(mktemp -d cache/Llf_WorkDir_XXXXX_$(date +%s))}"||true
|
||||||
mkdir -p "${workTmpDir}"
|
mkdir -p "${workTmpDir}"
|
||||||
if main; then true; else false; fi
|
export workTmpDir DISTRO kernel V
|
||||||
|
main
|
||||||
|
exit ${?}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# This shell script is contributed under the terms of GPL v2 by Thomas Schoenhuetl <pilleus.pulcher@arcor.de> 22.05.2007.
|
# This shell script is contributed under the terms of GPL v2 by Thomas Schoenhuetl <pilleus.pulcher@arcor.de> 22.05.2007.
|
||||||
|
|
||||||
# Modified script "slax2hd" for installing Generic Linux to hdd
|
# Modified script "slax2hd" for installing Generic Linux to hdd
|
||||||
# BY: Daniel K. aka Danieliskoto <http://danielisko.net, http://git.danielisko.net>
|
# BY: Daniel K. aka Danieliskot <http://danielisko.net, http://git.danielisko.net>
|
||||||
|
|
||||||
for i in dialog fdisk cfdisk sed grep mke2fs grub-install; do
|
for i in dialog fdisk cfdisk sed grep mke2fs grub-install; do
|
||||||
if [ ! -x $(command -v ${i}) ]; then
|
if [ ! -x $(command -v ${i}) ]; then
|
||||||
|
|||||||
+7
-9
@@ -1,16 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#set -eET -o pipefail
|
#set -eET -o pipefail
|
||||||
export setCompatFlags top
|
#trap 'echo $(basename ${BASH_SOURCE[0]}):${LINENO}: "${BASH_COMMAND}"' DEBUG
|
||||||
grep -q -- -x <<<"${setCompatFlags}"&&set -x
|
export setCompatFlags top LMK setCompatFlags
|
||||||
grep -q -- -n <<<"${setCompatFlags}"&&set -n
|
trap 'rm -rf ${TOP}/${INITRAMFS}{,.img};exit ${?}' INT TERM
|
||||||
grep -q -- -v <<<"${V}"&&set -v
|
|
||||||
cd "$(dirname $(readlink -f ${0}))"||false
|
cd "$(dirname $(readlink -f ${0}))"||false
|
||||||
. ../.config||false
|
. ../.config||false
|
||||||
trap 'rm -rf ${TOP}/${INITRAMFS}{,.img};exit ${?}' HUP INT QUIT ILL TRAP ABRT TERM
|
|
||||||
|
|
||||||
#add more ELFs, if need ;)
|
#add more ELFs, if need ;)
|
||||||
list=(bash tar e2fsck fsck.fat f2fs mdadm mount.ntfs-3g blkid)
|
list=(bash blkid tar e2fsck fsck.fat fsck.f2fs mdadm mount.ntfs-3g)
|
||||||
|
|
||||||
# copy file to initramfs tree, including
|
# copy file to initramfs tree, including
|
||||||
# all library dependencies (as shown by ldd)
|
# all library dependencies (as shown by ldd)
|
||||||
@@ -53,10 +51,10 @@ incDynElf()
|
|||||||
return ${?}
|
return ${?}
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p $([ ${V} ]&&echo ${V}) ${INITRAMFS}/{bin,dev,etc,lib{32,64,x32,},mnt,proc,root,run,sys,tmp,usr{,/local}/{sbin,bin,lib{32,64,x32,}},var/log}
|
mkdir -p ${INITRAMFS}/{bin,dev,etc,lib{32,64,x32,},mnt,proc,root,run,sys,tmp,usr{,/local}/{sbin,bin,lib{32,64,x32,}},var/log}
|
||||||
|
|
||||||
# If bb is not found use all static prebuilt
|
# If bb is not found use all static prebuilt
|
||||||
incDynElf busybox || { cp -f $([ ${V} ]&&echo ${V}) static/busybox ${INITRAMFS}/bin;static=true; }
|
incDynElf busybox || { cp -f static/busybox ${INITRAMFS}/bin;static=true; }
|
||||||
for i in $(${INITRAMFS}/bin/busybox --list|egrep -v "tar|init|blkid"); do ln -sf $([ ${V} ]&&echo ${V}) busybox ${INITRAMFS}/bin/$i; done
|
for i in $(${INITRAMFS}/bin/busybox --list|egrep -v "tar|init|blkid"); do ln -sf $([ ${V} ]&&echo ${V}) busybox ${INITRAMFS}/bin/$i; done
|
||||||
|
|
||||||
mknod ${INITRAMFS}/dev/console c 5 1
|
mknod ${INITRAMFS}/dev/console c 5 1
|
||||||
@@ -92,7 +90,7 @@ echo "root::0:0::/root:/bin/bash" >${INITRAMFS}/etc/passwd
|
|||||||
|
|
||||||
cp -f $([ ${V} ]&&echo ${V}) functions ${INITRAMFS}/lib
|
cp -f $([ ${V} ]&&echo ${V}) functions ${INITRAMFS}/lib
|
||||||
cp -f $([ ${V} ]&&echo ${V}) init shutdown ${INITRAMFS}
|
cp -f $([ ${V} ]&&echo ${V}) init shutdown ${INITRAMFS}
|
||||||
ln -sf -$([ ${V} ]&&echo ${V}) ../init ${INITRAMFS}/bin/init
|
ln -sf $([ ${V} ]&&echo ${V}) ../init ${INITRAMFS}/bin/init
|
||||||
cp -f $([ ${V} ]&&echo ${V}) ../.config ${INITRAMFS}/lib
|
cp -f $([ ${V} ]&&echo ${V}) ../.config ${INITRAMFS}/lib
|
||||||
chmod a+x -R $([ ${V} ]&&echo ${V}) ${INITRAMFS}
|
chmod a+x -R $([ ${V} ]&&echo ${V}) ${INITRAMFS}
|
||||||
|
|
||||||
|
|||||||
+7
-8
@@ -25,14 +25,13 @@ d()
|
|||||||
m()
|
m()
|
||||||
{
|
{
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
q) printf '%s' "[Question]: ${2}";;
|
q) echo -e "[Question]: ${2}";;
|
||||||
a) printf '%s' "[Answer]: ${2}";;
|
A) echo -e "[Action]: ${2}";;
|
||||||
A) printf '%s' "[Action]: ${2}";;
|
i) echo -e "[Info]: ${2}";;
|
||||||
i) printf '%s' "[Info]: ${2}";;
|
w) echo -e "[Warning]: ${2}";;
|
||||||
w) printf '%s' "[Warning]: ${2}";;
|
e) echo -e "[Error]: ${2}";;
|
||||||
e) printf '%s' "[Error]: ${2}";;
|
f) echo -e "[Fatal]: ${2}";;
|
||||||
f) printf '%s' "[Fatal]: ${2}";;
|
*) echo -e "${1}";;
|
||||||
*) printf '%s' "${1}";;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
rp()
|
rp()
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ exec >/dev/console >&1 2>&1 <&1
|
|||||||
[[ "${DEBUG_IS_ENABLED}" = "true" ]]&&set -x
|
[[ "${DEBUG_IS_ENABLED}" = "true" ]]&&set -x
|
||||||
debugShell
|
debugShell
|
||||||
echo "Linux Live Framework - Shutdown Magic!"
|
echo "Linux Live Framework - Shutdown Magic!"
|
||||||
echo "Entering to clean-up things before final step."
|
echo "Entering to clean-up things before ${action}..."
|
||||||
(
|
(
|
||||||
mdev -s
|
mdev -s
|
||||||
sleep 1.5
|
sleep 1.5
|
||||||
|
|||||||
Reference in New Issue
Block a user