Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
initrd
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
initrd
Commits
3472ef65
Kaydet (Commit)
3472ef65
authored
Nis 06, 2020
tarafından
Your Name
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
dil desteği eklendi
üst
ec0ae897
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
224 additions
and
87 deletions
+224
-87
Makefile
Makefile
+2
-0
tr_TR.UTF-8.txt
locale/tr_TR.UTF-8.txt
+53
-0
00-modules.sh
src/addons/00-modules.sh
+5
-5
01-extra-modules.sh
src/addons/01-extra-modules.sh
+1
-1
02-glibc.sh
src/addons/02-glibc.sh
+35
-0
03-fsck.sh
src/addons/03-fsck.sh
+5
-0
98-busybox.sh
src/addons/98-busybox.sh
+6
-4
99-config.sh
src/addons/99-config.sh
+2
-2
build-functions.sh
src/build-functions.sh
+19
-9
common.sh
src/common.sh
+24
-5
functions.sh
src/functions.sh
+10
-8
fstab
src/overlay/etc/fstab
+0
-0
00-clear.sh
src/scripts/00-clear.sh
+1
-1
01-dmesg.sh
src/scripts/01-dmesg.sh
+1
-1
02-modules.sh
src/scripts/02-modules.sh
+3
-4
03-fsck.sh
src/scripts/03-fsck.sh
+9
-2
50-networking.sh
src/scripts/50-networking.sh
+2
-2
97-fsmount.sh
src/scripts/97-fsmount.sh
+39
-36
98-overlay.sh
src/scripts/98-overlay.sh
+2
-2
99-fsswitch.sh
src/scripts/99-fsswitch.sh
+3
-3
vars.sh
src/vars.sh
+2
-2
No files found.
Makefile
Dosyayı görüntüle @
3472ef65
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
locale/tr_TR.UTF-8.txt
0 → 100644
Dosyayı görüntüle @
3472ef65
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
src/addons/00-modules.sh
Dosyayı görüntüle @
3472ef65
#!/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
}
src/addons/01-extra-modules.sh
Dosyayı görüntüle @
3472ef65
...
...
@@ -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
...
...
src/addons/02-glibc.sh
0 → 100644
Dosyayı görüntüle @
3472ef65
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
}
src/addons/03-fsck.sh
0 → 100644
Dosyayı görüntüle @
3472ef65
if
[
"
$skipfsck
"
!=
"true"
]
&&
[
"
$skipglibc
"
!=
"true"
]
;
then
copy_binary fsck fsck.
{
ext2,ext3,ext4,btrfs
}
else
warn
"fsck will not install"
fi
src/addons/98-busybox.sh
Dosyayı görüntüle @
3472ef65
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
src/addons/99-config.sh
Dosyayı görüntüle @
3472ef65
[
"
$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
src/build-functions.sh
Dosyayı görüntüle @
3472ef65
...
...
@@ -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
"Build
ing"
"
$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
}
src/common.sh
Dosyayı görüntüle @
3472ef65
...
...
@@ -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
}
src/functions.sh
Dosyayı görüntüle @
3472ef65
#!/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
"
\0
33[33;1m *
Where is the root
>
\0
33[;0m"
echo
-ne
"
\0
33[33;1m *
$(
translate
'Where is the root'
)
>
\0
33[;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
"
\0
33[33;1m * Where is the root>
\0
33[;0m"
warn
"
\"
$root
\"
$(
translate
'is not a block device'
)
"
echo
-ne
"
\0
33[33;1m *
$(
translate
'Where is the root'
)
>
\0
33[;0m"
fi
done
;;
esac
export
root
export
ro
export
rootfstype
export
init
}
src/overlay/etc/fstab
deleted
100644 → 0
Dosyayı görüntüle @
ec0ae897
src/scripts/00-clear.sh
Dosyayı görüntüle @
3472ef65
#!/busybox sh
[
-n
$debug
]
&&
clear
msg
"Starting
GNU/Linux"
msg
"Starting
"
"
GNU/Linux"
if
[
!
-n
$quiet
]
;
then
exec
>
/dev/null
exec
2>/dev/null
...
...
src/scripts/01-dmesg.sh
Dosyayı görüntüle @
3472ef65
inf
"Starting
dmesg"
inf
"Starting
"
"
dmesg"
/busybox dmesg
-n
1
||
true
src/scripts/02-modules.sh
Dosyayı görüntüle @
3472ef65
#!/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
src/scripts/03-fsck.sh
Dosyayı görüntüle @
3472ef65
#!/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
src/scripts/50-networking.sh
Dosyayı görüntüle @
3472ef65
#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
src/scripts/97-fsmount.sh
Dosyayı görüntüle @
3472ef65
...
...
@@ -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
src/scripts/98-overlay.sh
Dosyayı görüntüle @
3472ef65
[
-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
src/scripts/99-fsswitch.sh
Dosyayı görüntüle @
3472ef65
...
...
@@ -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
src/vars.sh
Dosyayı görüntüle @
3472ef65
PATH
=
/bin
:/usr/bin:/usr/sbin:/sbin
PATH
=
/bin
TERM
=
linux
LANGDIR
=
/locale
rootfstype
=
ext4
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment