Re-update all

pull/23/head
johndah4x0r 2017-07-26 12:49:13 +02:00 committed by GitHub
parent f695584985
commit a21d783923
3 changed files with 109 additions and 84 deletions

38
build
View File

@ -6,22 +6,23 @@
# Environment path
export PATH="${PATH}:.:./tools:../tools"
CHANGEDIR="$(dirname $0)"
echo "Changing current directory to $CHANGEDIR"
CWD="$(pwd)"
cd "$CHANGEDIR"
source ./.config || exit 1
source ./livekitlib || exit 1
# only root can continue, because only root can read all files from your system
allow_only_root
# Change directory to build environment
CHANGEDIR="$(dirname $0)"
echo "Changing current directory to $CHANGEDIR"
CWD="$(pwd)"
cd "$CHANGEDIR"
# It's building time!
clear
echo_livekit_msg "build: Linux Live Kit version 2.0 Improved"
echo_sign "BUILD SCRIPT"
echo_livekit_msg "build: Doing a self-check..."
# Start with 0 errors
@ -40,9 +41,11 @@ MKISOFS="$(which mkisofs 2>/dev/null || \
which genisoimage 2>/dev/null)"
if [ -z "$MKISOFS" ]; then
echo_err "build: 'mkisofs' / 'genisoimage': not-avail"
(( ERRS+=1 ))
# Hahaha! 'false'?!?!?
MKISOFS="false"
else
echo_livekit_msg "build: '`basename $MKISOFS`': avail"
echo_livekit_msg "build: '$(basename $MKISOFS)': avail"
fi
# Check if we have 'zip'
@ -165,9 +168,14 @@ echo_livekit_msg "build: Creating ISO file for CD boot..."
-R -D -A "$LIVEKITNAME" -V "$LIVEKITNAME" \
-no-emul-boot -boot-info-table -boot-load-size 4 \
-b "$LIVEKITNAME"/boot/isolinux.bin -c \
"$LIVEKITNAME"/boot/isolinux.boot . &>/dev/null && \
echo_livekit_msg "build: Output file: $OUT_FILE.iso" || \
echo_err "build: $OUT_FILE.iso: Failed to generate ISO file!"
"$LIVEKITNAME"/boot/isolinux.boot . &>/dev/null
if [ $? -ne 0 ]; then
echo_warn "build: Failed to generate ISO image!"
SCAN=
else
echo_livekit_msg "build: ISO image: $OUT_FILE.iso"
SCAN=1
fi
# Substitute 'mylinux' with $LIVEKITNAME
cat "$CWD/bootinfo.txt" | fgrep -v "#" | \
@ -188,7 +196,13 @@ echo_livekit_msg "build: Process ID: $PID - Your results is in $TARGET"
# Generate checksum(s)
echo_livekit_msg "build: Generating MD5 checksums: Please wait..."
if [ "$SCAN" ]; then
MD5_ISO="$(md5sum $TARGET/$OUT_FILE.iso 2>/dev/null | cut -d ' ' -f 1)"
else
MD5_ISO="< FAILED TO GENERATE ISO IMAGE! >"
fi
MD5_ZIP="$(md5sum $TARGET/$OUT_FILE.zip 2>/dev/null | cut -d ' ' -f 1)"
cat >"$SUM_FILE" <<EOF

View File

@ -17,7 +17,7 @@ BUNDLES=$MEMORY/bundles
clear
echo_bold "Live Kit Improved v1.0 - INIT"
echo_sign "INIT START"
init_proc_sysfs
@ -70,7 +70,7 @@ fstab_create "$UNION"
debug_shell
clear
echo_bold "Live Kit Improved v1.0 - INIT-DONE"
echo_sign "INIT END"
change_root "$UNION"
# If everything fails, panic immidiately

View File

@ -19,22 +19,22 @@ get_exclude()
return 1
fi
echo "$EXCLUDE_LIST" | tr " " "\n" | grep "$PARENT_DIR" | \
cut -d ":" -f 2 | while read KEY; do
echo "$EXCLUDE_LIST" | tr " " "\n" | grep "$PARENT_DIR" \
| while read KEY; do
echo -n "-e $KEY "
done
}
# Output functions
BLUE="\x1b[1;34m"
YELLOW="\x1b[1;33m"
ORANGE="\x1b[0;33m"
GREEN="\x1b[1;32m"
BOLD="\x1b[0;1m"
RED="\x1b[1;31m"
NC="\x1b[0m"
# NOTE: DO NOT TOUCH THE ESCAPE CHARACTERS!
BLUE=""
YELLOW=""
ORANGE=""
GREEN=""
BOLD=""
RED=""
NC=""
# echo-related
# debug related
debug_start()
{
if grep -q debug /proc/cmdline; then
@ -45,6 +45,7 @@ debug_start()
}
dbg_shell_start()
{
if grep -q 'dbg_shell' /proc/cmdline; then
DBG_SHELL=1
else
@ -54,17 +55,19 @@ dbg_shell_start()
debug_log()
{
if [ "$DBG_SHELL" ]; then
echo -e "[ ${GREEN}"'debug'"${NC} ]: $@" >&2
if [ "$DEBUG_IS_ENABLED" ]; then
echo "[${GREEN}"' debug '"${NC}]: $@" >&2
log "debug_log: $*"
fi
}
# echo related functions
# echo fatal tag
# $1 = text to show
echo_fatal()
{
echo -e "[${RED}"' fatal '"${NC}] $@" >&2
echo "[${RED}"' fatal '"${NC}] $@" >&2
}
# echo bold
@ -72,30 +75,36 @@ echo_fatal()
#
echo_bold()
{
echo -e "$BOLD""$@""$NC"
echo "$BOLD""$@""$NC"
}
# echo livekit tag
echo_livekit()
{
echo -ne "[${BLUE}"'livekit'"${NC}] "
echo "[${BLUE}"'livekit'"${NC}] "
}
echo_livekit_msg()
{
echo -e "[${BLUE}"'livekit'"${NC}] $@"
echo "[${BLUE}"'livekit'"${NC}] $@"
}
# echo error
echo_err()
{
echo -e "[${RED}"' error '"${NC}] $@" >&2
echo "[${RED}"' error '"${NC}] $@" >&2
}
# echo warn
echo_warn()
{
echo -e "[${YELLOW}"' warn! '"${NC}] $@" >&2
echo "[${YELLOW}"' warn! '"${NC}] $@" >&2
}
# echo signature
echo_sign()
{
echo "${BOLD}"' Linux Live Kit Improved v1.0 - '"$* ${NC}"
}
# log - store given text in /var/log/livedbg
@ -113,11 +122,10 @@ echolog()
# show information about the debug shell
show_debug_banner()
{
echo_livekit >&2
echo "Debugging shell started." >&2
echo_sign "DEBUGGING MODE"
echo "The root shell is prepared for you!" >&2
echo "Type your desired commands or press Ctrl-D to continue booting." >&2
echo
echo >&2
}
# debug_shell
@ -125,7 +133,7 @@ show_debug_banner()
#
debug_shell()
{
if [ "$DEBUG_IS_ENABLED" ]; then
if [ "$DBG_SHELL" ]; then
show_debug_banner
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
echo
@ -136,9 +144,8 @@ fatal()
{
log "FatalError: $@"
echo_fatal "$@"
echo -e "${RED}"'Please reboot this system now!'"${NC}"
echo -e "${BOLD}"'Live Kig Log: /var/log/livekit-log'"${NC}"
echo -e "${BOLD}"'To get more information, please consult Live Kit Log for more info.'"${NC}"
echo_sign "EMERGENCY MODE" >&2
echo_bold "Please consult /var/log/livekit-log for more info." >&2
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
}
@ -148,7 +155,7 @@ fatal()
allow_only_root()
{
if [ "0$UID" -ne 0 ]; then
echo_err "Only root can run `basename $0`"; exit 1
echo_err "Only root can run $(basename $0)"; exit 1
fi
}
@ -207,7 +214,7 @@ transfer_initramfs()
fi
}
# mount virtual filesystems like proc etc
# mount virtual filesystems like proc, sys and such
#
init_proc_sysfs()
{
@ -276,9 +283,10 @@ init_aufs()
debug_log "init_aufs" "$*"
# TODO maybe check here if aufs support is working at all
# and produce useful error message if user has no aufs
modprobe aufs 2>/dev/null
modprobe aufs 2>/var/log/livekit-log
# if aufs module failed to load, panic immidiately
# TODO ACCOMPLISHED:
# If aufs module failed to load, panic immidiately
if [ $? -ne 0 ]; then
fatal "Failed to load AUFS module!"
fi
@ -347,11 +355,14 @@ device_bestfs()
debug_log "device_bestfs" "$*"
local FS
FS="$(blkid "$1" | sed -r "s/.*TYPE=//" | tr -d '"' | tr [A-Z] [a-z] | cut -d ' ' -f 1)"
FS="$(blkid "$1" | sed -r "s/.*TYPE=//" | tr -d '"' | \
tr "[A-Z]" "[a-z]" | cut -d ' ' -f 1)"
if [ "$FS" = "msdos" -o "$FS" = "fat" ]; then
FS="vfat"
elif [ "$FS" = "ntfs" ]; then
FS="ntfs-3g"
else
FS="$FS"
fi
echo "-t $FS"
}
@ -477,9 +488,9 @@ find_data_try()
# if the FROM parameter is actual file, mount it again as loop (eg. iso)
if [ -f "$1/$FROM" ]; then
mount -o remount,rw "$DEVICE" "$1" 2>/dev/null
mkdir -p "$1/../iso"
mount -o loop,ro "$1/$FROM" "$1/../iso" 2>/dev/null
FROM="../iso/$LIVEKITNAME"
mkdir -p "$1/../file"
mount -o loop,ro "$1/$FROM" "$1/../file" 2>/dev/null
FROM="../file/$LIVEKITNAME"
fi
# search for bundles in the mounted directory