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

dil desteği eklendi

üst ec0ae897
install:
[ -d $(DESTDIR)/lib/initrd/ ] && rm -rf $(DESTDIR)/lib/initrd/ || true
mkdir $(DESTDIR)/lib/initrd/
mkdir $(DESTDIR)/lib/initrd/locale
cp -prfv src/* $(DESTDIR)/lib/initrd/
cp -prfv locale/* $(DESTDIR)/lib/initrd/locale
[ -f $(DESTDIR)/bin/update-initrd ] && rm -f $(DESTDIR)/bin/update-initrd || true
ln -s $(DESTDIR)/lib/initrd/build.sh $(DESTDIR)/bin/update-initrd
chmod +x $(DESTDIR)/lib/initrd/build.sh
Creating workdir::Çalışma dizini oluşturuluyor
Merging with overlay::Overlay ile birleştiriliyor
Install modules::Yüklenen modül
Clearing workdir::Çalışma dizini temizleniyor
Keeping workdir::Çalışma dizini korunuyor
Install main modules::Ana modüller yükleniyor
Install drivers::Sürücüler yükleniyor
Module directory not found::Modül dizini bulunamadı
Kernel Version::Çekirdek Sürümü
Module Directory::Modül Dizini
Install::Yükleniyor
glibc will not install::glbc yüklenmeyecek
fsck will not install::fsck yüklenmeyecek
Install busybox::Busybox yükleniyor
Busybox is not a static binary::Busybox statik bir ikili değil
Busybox not found::Busybox bulunamadı
Using config::Kullanılan yapılandırma
Building::İnşa ediliyor
Generating::Oluşturuluyor
Generating fallback::Yedek oluşturuluyor
Starting::Baslatiliyor
Listing kernel modules::Cekirdek modulleri listeleniyor
Trying to load kernel modules::Cekirdek modullerini yuklenmeye calisiyor
Running::Calisiyor
fsck not found::fsck bulunamadi
Trying to connect network::Aga baglantisi kurulmaya calisiliniyor
Found network device::Bulunan ag aygiti
Moving mountpoints::Baglama noktasi tasiniyor
Creating overlayfs::Overlayfs olusturuluyor
Looking for::Sunun icin bakiliyor
Detected live media::Tespit edilen canli ortam
Mounting live media::Canli ortam baglaniyor
Mounting freeze media::Donmuş ortam baglaniyor
Mounting rootfs::Kok dizin baglaniyor
Creating tmpfs for /::/ icin tmpfs olusturuluyor
Creating binds::Baglar olusturuluyor
Binding::Baglanıyor
Booting from live-media::Canli ortamdan baslatiliyor
Booting from::Suradan baslatiliyor
Starting overlay scripts::Overlay betikleri baslatiliyor
Wellcome to::Hosgeldiniz
Running local initrd scripts::Yerel acilis betikleri calistiriliyor
Switching root::Kok degistiriliyor
Creating initrd::Initrd olusturuluyor
Mount handler running::Baglama islemleri calisiyor
UEFI mode detected::UEFI modu tespit edildi
Booting dead. Now you are in initial ramdisk.::Acilis nallari dikti. Simdi baslangıc ramdiski icindesin.
Detecting real root::Gercek kok tespit ediliyor
No root device specified.::Hicbir kok blirlenmedi.
Where is the root::Kok nerde amk
Setting root::Kok ayarlaniyor
is not a block device::bir blok algit değil
#!/bin/bash
[ ! -n "$KERNELVER" ] && KERNELVER=$(uname -r)
[ ! -n "$MODDIR" ] && MODDIR=/lib/modules/${KERNELVER}
[ -d $MODDIR ] || err "Module directory not found -> $MODDIR"
[ -d $MODDIR ] || err "Module directory not found" "-> $MODDIR"
debug "Kernel Version: ${KERNELVER}"
debug "Module Directory: ${MODDIR}"
debug "Kernel Version" "${KERNELVER}"
debug "Module Directory" "${MODDIR}"
mkdir -p ${WORKDIR}/${MODDIR}
debug "Install: main modules"
debug "Install main modules"
cp -prf ${MODDIR}/kernel/{crypto,fs,lib} ${WORKDIR}/${MODDIR}
debug "Install: drivers"
debug "Install drivers"
cp -prf ${MODDIR}/kernel/drivers/{block,ata,md,firewire} ${WORKDIR}/${MODDIR}
cp -prf ${MODDIR}/kernel/drivers/{scsi,pcmcia,virtio} ${WORKDIR}/${MODDIR}
cp -prf ${MODDIR}/kernel/drivers/usb/{host,storage} ${WORKDIR}/${MODDIR}
......@@ -2,7 +2,7 @@ add_extra_module(){
while read line
do
name=$(basename $line)
debug "Install: $name"
debug "Install" "$name"
mkdir -p ${WORKDIR}/$line
rmdir ${WORKDIR}/$line
cat $line > ${WORKDIR}/$line
......
if [ "$skipglibc" != "false" ] ; then
warn "glibc will not install"
return 0
fi
mkdir -p ${WORKDIR}/lib 2>/dev/null || true
mkdir -p ${WORKDIR}/xbin 2>/dev/null || true
msg "Install" "glibc"
for i in #libtinfo.so.5 libdl.so.2 libc.so.6 ld-linux-x86-64.so.2
do
[ -f /lib/$i ] && LIBDIR=/lib
[ -f /lib64/$i ] && LIBDIR=/lib64
[ -f /usr/lib/$i ] && LIBDIR=/usr/lib
[ -f /usr/lib64/$i ] && LIBDIR=/usr/lib64
install ${LIBDIR}/$i ${WORKDIR}/lib/$i || true
done
copy_binary(){
for bins in $*
do
libs="$(ldd $(which $bins) | grep '=>' | awk '{print $1}')"
for i in $libs
do
lib=$(basename $i)
if [ ! -f "${WORKDIR}/$lib" ] ; then
debug "Install" "$lib"
[ -f /lib/$lib ] && LIBDIR=/lib
[ -f /lib64/$lib ] && LIBDIR=/lib64
[ -f /usr/lib/$lib ] && LIBDIR=/usr/lib
[ -f /usr/lib64/$lib ] && LIBDIR=/usr/lib64
install ${LIBDIR}/$lib ${WORKDIR}/lib/$lib || true
fi
done
msg "Install" "$(which $bins)"
install $(which $bins) ${WORKDIR}/xbin/$bins
done
}
if [ "$skipfsck" != "true" ] && [ "$skipglibc" != "true" ] ; then
copy_binary fsck fsck.{ext2,ext3,ext4,btrfs}
else
warn "fsck will not install"
fi
bb=$(which busybox)
if [ -f "$bb" ] ; then
if ldd $bb | grep "not a dynamic executable" >/dev/null ; then
debug "Install busybox: $bb"
if LANG="C" ldd $bb | grep "not a dynamic executable" >/dev/null ; then
debug "Install busybox" "$bb"
install $bb $WORKDIR/busybox >/dev/null
elif [ "$skipglibc" != "false" ] ; then
copy_binary busybox
else
err "Busybox is not a static binary."
err "Busybox is not a static binary"
exit 1
fi
else
err "Busybox not found."
err "Busybox not found"
exit 1
fi
[ "$CONFIG" != "" ] || CONFIG=/etc/initrd.conf
debug "Using config: $CONFIG"
debug "Using config" "$CONFIG"
mkdir -p ${WORKDIR}/etc
if [ -f $CONFIG ] ; then
cat ${CONFIG} > ${WORKDIR}/etc/initrd.conf
else
echo > ${WORKDIR}/etc/initrd.conf
echo "LANG=$LANG" > ${WORKDIR}/etc/initrd.conf
fi
......@@ -15,6 +15,8 @@ General option list:
-n / --no-color Disable colorized output.
-c / --no-cpio Do not generate initrd image.
-f / --fallback Generate fallback initrd image.
-g / --no-glibc Do not install glibc module. (Disable dinamic library support.)
-s / --no-fsck Do not install fsck module.
EOF
}
......@@ -32,7 +34,9 @@ parse_args(){
export OUTPUT=/boot/initrd.img-$(uname -r)
export nocolor=false
export keepworkdir=false
export debug=false
export skipglibc=false
export skipfsck=false
export LANGDIR=/lib/initrd/locale
for i in $*
do
if [ "$i" == "-h" ] || [ "$i" == "--help" ] ; then
......@@ -42,6 +46,10 @@ parse_args(){
debug=true
elif [ "$i" == "-k" ] || [ "$i" == "--keep" ] ; then
keepworkdir=true
elif [ "$i" == "-g" ] || [ "$i" == "--no-glibc" ] ; then
skipglibc=true
elif [ "$i" == "-s" ] || [ "$i" == "--no-fsck" ] ; then
skipfsck=true
elif [ "$i" == "-n" ] || [ "$i" == "--no-color" ] ; then
export nocolor=true
elif [ "$i" == "-c" ] || [ "$i" == "--no-cpio" ] ; then
......@@ -49,12 +57,12 @@ parse_args(){
elif [ "$i" == "-f" ] || [ "$i" == "--fallback" ] ; then
fallback=true
else
export $i
export $i 2>/dev/null || true
fi
done
}
generate_workdir(){
msg "Creating workdir $WORKDIR"
msg "Creating workdir" "$WORKDIR"
rm -f $WORKDIR
mkdir -p $WORKDIR
cp -prf $src/scripts $WORKDIR/scripts
......@@ -64,24 +72,26 @@ generate_workdir(){
done
msg "Merging with overlay"
cp -prf $src/overlay/* $WORKDIR
mkdir $WORKDIR/locale
cp -prf $src/locale/* $WORKDIR/locale
}
modules_install(){
for i in $(ls $src/addons | sort)
do
inf "Install modules: $i"
inf "Install modules" "$i"
. $src/addons/$i
done
}
generate_cpio(){
msg "Build: $OUTPUT "
msg "Building" "$OUTPUT "
cd $WORKDIR
if [ "$nocpio" != "true" ] ; then
echo -ne " ${C_GREEN}*${C_CLEAR} Generating: "
echo -ne " ${C_GREEN}*${C_CLEAR} $(translate 'Generating') "
find . | cpio -R root:root -H newc -o | gzip > $OUTPUT
fi
if [ "$fallback" == "true" ] ; then
echo -ne " ${C_GREEN}*${C_CLEAR} Generating fallback: "
echo -ne " ${C_GREEN}*${C_CLEAR} $(translate 'Generating fallback') "
find . | cpio -R root:root -H newc -o | gzip > $OUTPUT-fallback
fi
}
......@@ -89,8 +99,8 @@ generate_cpio(){
clean_directory(){
if [ "$keepworkdir" != "true" ] ; then
rm -rf $WORKDIR
msg "Clearing workdir."
msg "Clearing workdir"
else
inf "Keeping workdir: $WORKDIR"
inf "Keeping workdir" "$WORKDIR"
fi
}
......@@ -9,19 +9,38 @@ if [ -t 0 ] && [ "$nocolor" != "true" ] ;then
C_WHITE='\e[1;37m'
C_CLEAR='\e[m'
fi
[ "$LANG" == "" ] && LANG="C"
LANGFILE=${LANGDIR}/$(echo $LANG).txt
msg() {
echo -e " ${C_GREEN}*${C_CLEAR} ${@}"
message=$(translate $1)
echo -e " ${C_GREEN}*${C_CLEAR} $message $2"
}
inf() {
echo -e " ${C_CYAN}*${C_CLEAR} ${@}"
message=$(translate $1)
echo -e " ${C_CYAN}*${C_CLEAR} $message $2"
}
debug() {
[ ! -n "$debug" ] || echo -e " ${C_BLUE}*${C_CLEAR} ${@}"
message=$(translate $1)
[ ! -n "$debug" ] || echo -e " ${C_BLUE}*${C_CLEAR} $message $2"
}
warn() {
echo -e " ${C_YELLOW}*${C_CLEAR} ${@}"
message=$(translate $1)
echo -e " ${C_YELLOW}*${C_CLEAR} $message $2"
}
err() {
echo -e " ${C_RED}*${C_CLEAR} ${@}"
message=$(translate $1)
echo -e " ${C_RED}*${C_CLEAR} $message $2"
}
translate(){
if [ ! -f ${LANGFILE} ] ; then
echo $*
return 0
fi
word=$(cat ${LANGFILE} | grep "$*::" | head -n 1 | sed "s/^.*:://g")
if [ "$word" == "" ] ; then
echo -n "$*"
else
echo -n "$word"
fi
}
#!/busybox sh
generate_rootfs(){
msg "Creating initrd"
/busybox mkdir /bin
/busybox mkdir /sys
/busybox mkdir /proc
/busybox mkdir /tmp
/busybox mkdir /run
/busybox --install -s /bin
msg 'Creating initrd'
/busybox mdev -s 2>/dev/null
}
run_modules(){
for i in $(ls /scripts | sort)
do
debug "Running $i"
debug "Running" "$i"
. /scripts/$i || true
done
}
......@@ -24,9 +24,10 @@ mount_handler(){
/busybox mount -t tmpfs tmpfs /tmp || true
/busybox mount -t tmpfs tmpfs /run || true
if [ -e /sys/firmware/efi ]; then
inf "UEFI mode detected."
inf "UEFI mode detected"
mount -t efivarfs efivarfs /sys/firmware/efi/efivars -o nosuid,nodev,noexec
fi
export memtotal=$(cat /proc/meminfo | grep MemTotal | sed "s/.* //" | sed "s/ .*//g")
}
parse_cmdline(){
for i in $(cat /proc/cmdline)
......@@ -76,19 +77,20 @@ detect_root(){
LABEL=*) eval $root; device="/dev/disk/by-label/$LABEL" ;;
"" ) [ "$boot" == "live" ] && return 0
err "No root device specified."
echo -ne "\033[33;1m * Where is the root > \033[;0m"
echo -ne "\033[33;1m * $(translate 'Where is the root') > \033[;0m"
while read root
do
if [ -b $root ] ; then
inf "Setting root $root"
if [ -b $root ] && [ "$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"
warn "\"$root\" $(translate 'is not a block device')"
echo -ne "\033[33;1m * $(translate 'Where is the root') > \033[;0m"
fi
done ;;
esac
export root
export ro
export rootfstype
export init
}
#!/busybox sh
[ -n $debug ] && clear
msg "Starting GNU/Linux"
msg "Starting" "GNU/Linux"
if [ ! -n $quiet ] ; then
exec >/dev/null
exec 2>/dev/null
......
inf "Starting dmesg"
inf "Starting" "dmesg"
/busybox dmesg -n 1 || true
#!/busybox sh
debug "Listing kernel modules"
find /lib/modules/ | sed "s/.*\///g" | grep "\.ko$" | sed "s/.ko$//g" | sed "s/^/modprobe /g"> /load_modules.sh
msg "Loading kernel modules"
sh /load_modules.sh 2> /dev/null | cat > /dev/null || fallback_shell
find /lib/modules/ | sed "s/.*\///g" | grep "\.ko$" | sed "s/.ko$/ &/g" | sed "s/^/modprobe /g"> /load_modules.sh
msg "Trying to load kernel modules"
sh /load_modules.sh 1>/dev/null 2>&1
#!/busybox sh
inf "Running fsck"
fsck -Ta -y -t $rootfstype "$root" 2>/dev/null
[ "$boot" == "live" ] && return 0
if [ -f /xbin/fsck ] ; then
inf "Running" "fsck"
touch /etc/mtab
touch /etc/fstab
/xbin/fsck.$rootfstype -f -y "$root" || true
else
warn "fsck not found"
fi
#Thanks for mll: https://github.com/ivandavidov/minimal
msg "Trying to connect network."
msg "Trying to connect network"
for DEVICE in /sys/class/net/* ; do
inf "Found network device ${DEVICE##*/}" || true
inf "Found network device" "${DEVICE##*/}" || true
ip link set ${DEVICE##*/} up || true
[ ${DEVICE##*/} != lo ] && udhcpc -b -i ${DEVICE##*/} -s /etc/05_rc.dhcp || true
done
......@@ -8,47 +8,50 @@ common_boot(){
mount --move /tmp /rootfs/tmp
mount --move /run /rootfs/run
}
overlay_mount(){
mkdir -p /root/a # upper
mkdir -p /root/b # workdir
mkdir -p /rootfs/
umount /root/a 2>/dev/null
umount /root/b 2>/dev/null
debug "Creating overlayfs"
mount -t overlay -o lowerdir=/source/,upperdir=/root/a,workdir=/root/b overlay /rootfs
if [ "$overlay" == "zram" ]; then
modprobe zram num_devices=1 2>/dev/null || true
echo $(($memtotal)) > /sys/block/zram0/disksize
sh
mkfs.ext2 /dev/zram0
mount -t auto /dev/zram0 /root/a
mount -t tmpfs -o size=100% none /root/b
else
mount -t tmpfs -o size=100% none /root/b
mount -t tmpfs -o size=100% none /root/a
fi
}
live_boot(){
[ "$sfs" == "" ] && sfs="/main.sfs"
list=$(ls /sys/class/block/ | grep ".*[0-9]$" | grep -v loop | grep -v ram | grep -v nbd | sed "s|^|/dev/|g")
for part in $list
do
debug "Looking for $part"
debug "Looking for" "$part"
if is_file_avaiable "$part" "${sfs}"
then
debug "Detected live media: $part"
debug "Detected live media" "$part"
export root=$part
fi
done
mkdir -p /root/a # upper
mkdir -p /root/b # workdir
mkdir -p /rootfs/
mkdir -p /source/ # lower
mkdir -p /output
debug "Mounting live media"
mount -t auto $root /output
mount /output/${sfs} /source
umount /root/a 2>/dev/null
umount /root/b 2>/dev/null
debug "Creating overlayfs"
mount -t overlay -o lowerdir=/source/,upperdir=/root/a/,workdir=/root/b overlay /rootfs
mount -t tmpfs -o size=100% none /root/a
mount -t tmpfs -o size=100% none /root/b
overlay_mount
[ -d /output/merge ] && cp -prfv /output/merge/* /rootfs/
common_boot || fallback_shell
}
freeze_mount(){
mkdir -p /root/a # upper
mkdir -p /root/b # workdir
mkdir -p /rootfs/
freeze_boot(){
mkdir -p /source/ # lower
debug "Mounting freeze media"
mount -t auto $root /source
umount /root/a 2>/dev/null
umount /root/b 2>/dev/null
debug "Creating overlayfs"
mount -t overlay -o lowerdir=/source/,upperdir=/root/a/,workdir=/root/b overlay /rootfs
mount -t tmpfs -o size=100% none /root/a
mount -t tmpfs -o size=100% none /root/b
mount -t auto -o defaults,ro $root /source
overlay_mount
common_boot || fallback_shell
}
......@@ -56,18 +59,17 @@ normal_boot(){
debug "Mounting rootfs"
mkdir -p /rootfs
mkdir -p /newroot
mount -t auto $root /newroot
mount -t auto -o defaults,rw $root /newroot
debug "Creating tmpfs for /"
mount -t tmpfs tmpfs /rootfs
mkdir -p /rootfs/tmp
mkdir -p /rootfs/run
mkdir -p /rootfs/dev
mkdir -p /rootfs/sys
mkdir -p /rootfs/proc
for i in dev sys proc run tmp
do
mkdir -p /rootfs/$i 2>/dev/null || true
done
debug "Creating binds"
for i in boot bin lib32 etc kernel lib64 sbin usr data lib root var
do
debug "Binding /$i"
debug "Binding" "/$i"
mkdir -p /rootfs/$i
mount --bind /newroot/$i /rootfs/$i
done
......@@ -77,20 +79,21 @@ normal_boot(){
classic_boot(){
debug "Mounting rootfs"
mkdir -p /rootfs
mount -t auto $root /rootfs
[ "$ro" == "" ] && ro=rw
mount -t auto -o defaults,$ro $root /rootfs
common_boot || fallback_shell
}
if [ "$boot" == "live" ]; then
msg "Booting from live-media ($root)"
msg "Booting from live-media" "($root)"
live_boot || fallback_shell
elif [ "$boot" == "normal" ]; then
msg "Booting from $root"
msg "Booting from" "$root"
normal_boot || fallback_shell
elif [ "$boot" == "freeze" ]; then
msg "Booting from $root (freeze)"
msg "Booting from" "$root (freeze)"
freeze_boot || fallback_shell
else
msg "Booting from $root (classic)"
msg "Booting from" "$root (classic)"
classic_boot || fallback_shell
fi
[ -d /autorun ] || return 0
inf "Starting overlay autorun scripts."
inf "Starting overlay scripts"
for i in $(ls /autorun | sort)
do
debug "Running $i"
debug "Running" "$i"
/busybox sh /autorun/$i
done
......@@ -5,17 +5,17 @@ debug "Subdir=$subdir"
debug "init=$init"
if [ -f /rootfs/$subdir/etc/os-release ]; then
msg "Wellcome to ${C_PURPLE}$(cat /rootfs/$subdir/etc/os-release | grep '^NAME=' | head -n 1 | sed 's/^.*=//g')$C_CLEAR"
msg "Wellcome to" "${C_PURPLE}$(cat /rootfs/$subdir/etc/os-release | grep '^NAME=' | head -n 1 | sed 's/^.*=//g')$C_CLEAR"
else
msg "Wellcome to ${C_PURPLE}GNU/Linux...${C_CLEAR}"
msg "Wellcome to" "${C_PURPLE}GNU/Linux...${C_CLEAR}"
fi
sleep 2
if [ -f /rootfs/$subdir/etc/initrd.local ]; then
inf "Running local initrd scripts"
. /rootfs/$subdir/etc/initrd.local || true
fi
debug "Switching root"
exec env -i \
"TERM=$TERM" \
"LANG=$LANG"\
switch_root "/rootfs/$subdir" $init "$@" || fallback_shell
PATH=/bin:/usr/bin:/usr/sbin:/sbin
PATH=/bin
TERM=linux
LANGDIR=/locale
rootfstype=ext4
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