Kaydet (Commit) d43dc12e authored tarafından Your Name's avatar Your Name

eklemeler

üst 58693f9a
debug "Install busybox: $(which busybox)"
install $(which busybox) $WORKDIR/busybox >/dev/null
bb=$(which busybox)
if [ -f "$bb" ] ; then
if ldd $bb | grep "not a dynamic executable" >/dev/null ; then
debug "Install busybox: $bb"
install $bb $WORKDIR/busybox >/dev/null
else
err "Busybox is not a static binary."
exit 1
fi
else
err "Busybox not found."
exit 1
fi
......@@ -31,19 +31,21 @@ parse_args(){
export WORKDIR=$(mktemp)
export OUTPUT=/boot/initrd.img-$(uname -r)
export nocolor=false
export keepworkdir=false
export debug=false
for i in $*
do
if [ "$i" == "-h" ] || [ "$i" == "--help" ] ; then
help_msg
exit 0
elif [ "$i" == "-d" ] || [ "$i" == "--debug" ]; then
export debug=true
debug=true
elif [ "$i" == "-k" ] || [ "$i" == "--keep" ] ; then
export keepwordkir=true
keepworkdir=true
elif [ "$i" == "-n" ] || [ "$i" == "--no-color" ] ; then
nocolor=true
export nocolor=true
elif [ "$i" == "-c" ] || [ "$i" == "--no-cpio" ] ; then
nocpio=true
export nocpio=true
elif [ "$i" == "-f" ] || [ "$i" == "--fallback" ] ; then
fallback=true
else
......@@ -60,6 +62,8 @@ generate_workdir(){
do
install $src/$file.sh $WORKDIR/$file
done
msg "Merging with overlay"
cp -prf $src/overlay/* $WORKDIR
}
modules_install(){
for i in $(ls $src/addons | sort)
......@@ -83,7 +87,7 @@ generate_cpio(){
}
clean_directory(){
if [ "$keepworkdir" == "true" ] ; then
if [ "$keepworkdir" != "true" ] ; then
rm -rf $WORKDIR
msg "Clearing workdir."
else
......
......@@ -24,7 +24,7 @@ mount_handler(){
/busybox mount -t tmpfs tmpfs /tmp || true
/busybox mount -t tmpfs tmpfs /run || true
if [ -e /sys/firmware/efi ]; then
msg "UEFI mode detected."
inf "UEFI mode detected."
mount -t efivarfs efivarfs /sys/firmware/efi/efivars -o nosuid,nodev,noexec
fi
}
......@@ -75,7 +75,17 @@ detect_root(){
UUID=* ) eval $root; device="/dev/disk/by-uuid/$UUID" ;;
LABEL=*) eval $root; device="/dev/disk/by-label/$LABEL" ;;
"" ) err "No root device specified."
echo -ne "\033[33;1mWhere is the root>\033[;0m"; read root ;;
echo -ne "\033[33;1m * Where is the root > \033[;0m"
while read root
do
if [ -b $root ] ; then
inf "Setting root $root"
return 0
else
warn "\"$root\" is not a block device."
echo -ne "\033[33;1m * Where is the root>\033[;0m"
fi
done ;;
esac
export root
export rootfstype
......
#!/bin/sh
# This script gets called by udhcpc to setup the network interfaces
ip addr add $ip/$mask dev $interface
if [ "$router" ]; then
ip route add default via $router dev $interface
fi
if [ "$ip" ]; then
echo -e "DHCP configuration for device $interface"
echo -e "IP: \\e[1m$ip\\e[0m"
echo -e "mask: \\e[1m$mask\\e[0m"
echo -e "router: \\e[1m$router\\e[0m"
fi
# /etc/hosts
127.0.0.1 localhost
# ipv6
::1 localhost ipv6-localhost
# The number of active DNS resolvers is limited to 3.
#
# https://linux.die.net/man/5/resolv.conf
#
# The MLL strategy is to use one DNS resolver from each provider. The
# first declared DNS resolver is the default one.
# CloudFlare DNS
# http://blog.cloudflare.com/announcing-1111
nameserver 1.1.1.1
#nameserver 1.0.0.1
# Quad9 DNS
# http://quad9.net
nameserver 9.9.9.9
# Google Public DNS
# http://developers.google.com/speed/public-dns
nameserver 8.8.8.8
#nameserver 8.8.4.4
#!/busybox sh
[ -n $debug ] && clear
msg "Starting GNU/Linux"
[ ! -n $quiet ] && exec >/dev/null
if [ ! -n $quiet ] ; then
exec >/dev/null
exec 2>/dev/null
fi
msg "Starting dmesg"
inf "Starting dmesg"
/busybox dmesg -n 1 || true
#!/busybox sh
msg "Running fsck"
mkdir /etc/
touch /etc/fstab
inf "Running fsck"
fsck -Ta -y -t $rootfstype "$root" 2>/dev/null
#Thanks for mll: https://github.com/ivandavidov/minimal
msg "Trying to connect network."
for DEVICE in /sys/class/net/* ; do
inf "Found network device ${DEVICE##*/}"
ip link set ${DEVICE##*/} up
[ ${DEVICE##*/} != lo ] && udhcpc -b -i ${DEVICE##*/} -s /etc/05_rc.dhcp
done
......@@ -11,7 +11,7 @@ debug "Subdir=$subdir"
debug "init=$init"
if [ -f /new_root/$subdir/etc/initrd.local ]; then
msg "Running local initrd scripts"
inf "Running local initrd scripts"
. /new_root/$subdir/etc/initrd.local || true
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment