linux-live/initramfs/init

78 lines
1.3 KiB
Bash

#!/bin/sh
# Initial script for Linux Live Kit / Linux Live Kit Improved
# Modifier: "JohnDaH4x0r"
export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin
. /lib/.config
. /lib/livekitlib
transfer_initramfs
MEMORY=/memory
CHANGES=$MEMORY/changes
UNION=$MEMORY/union
DATAMNT=$MEMORY/data
BUNDLES=$MEMORY/bundles
clear
echo_bold "Live Kit Improved v1.0 - INIT"
init_proc_sysfs
# initialise debugging
debug_start
dbg_shell_start
# 1st round debug shell (do not touch!)
debug_shell
# load some modules manually first, then modprobe everything we have
init_devs
init_aufs
init_zram
modprobe_everything
# find data dir with filesystem bundles
DATA="$(find_data 60 "$DATAMNT")"
# 2nd round debug shell (do not touch!)
debug_shell
# setup persistent changes, if possible
persistent_changes "$DATA" "$CHANGES"
# 3rd round debugg shell
debug_shell
# copy to RAM if needed
DATA="$(copy_to_ram "$DATA" "$CHANGES")"
# init aufs union
init_union "$CHANGES" "$UNION"
# 4th debug shell round
debug_shell
# add data to union
union_append_bundles "$DATA" "$BUNDLES" "$UNION"
# 5th debug shell round
debug_shell
# rootcopy
copy_rootcopy_content "$DATA" "$UNION"
# create empty fstab
fstab_create "$UNION"
# 6th debug shell round
debug_shell
clear
echo_bold "Live Kit Improved v1.0 - INIT-DONE"
change_root "$UNION"
# If everything fails, panic immidiately
fatal "Unknown error!"