mesa upgraded to version 17.3.1
[dragora.git] / stages / 2 / 02-initramfs
blob27420d64c1afba673c27bb833e51b25f1dafedcc
1 # Build script for the single-purpose initramfs (liveCD).
3 # Copyright (c) 2017 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 mkdir -p -- "${rootdir}/initrd"
19 cat << "EOF" > "${rootdir}/initrd/init"
20 #! /bin/busybox ash
22 /bin/busybox sleep 7
24 /bin/busybox mkdir -p /dev /proc /sys /.UP
26 /bin/busybox mount -n -o nosuid,noexec,nodev -t proc proc /proc
27 /bin/busybox mount -n -o nosuid,noexec,nodev -t sysfs sysfs /sys
28 /bin/busybox mount -n -t devtmpfs devtmpfs /dev
30 /bin/busybox sleep 3
32 /bin/busybox mount -n -o rw,size=100% -t tmpfs tmpfs /.UP
33 /bin/busybox mkdir /.UP/cdrom /.UP/rw /.UP/squash /.UP/union
35 # Mount ISO and system image
36 /bin/busybox mount -n -t iso9660 LABEL=Dragora /.UP/cdrom
37 /bin/busybox mount -n -o loop -t squashfs /.UP/cdrom/dragora.sfs /.UP/squash
39 # Merge Squashfs with AUFS
40 /bin/busybox mount -o br=/.UP/rw:/.UP/squash -t aufs none /.UP/union
42 # Move virtual file systems prior to switch_root
43 /bin/busybox mount --move /dev   /.UP/union/dev
44 /bin/busybox mount --move /proc  /.UP/union/proc
45 /bin/busybox mount --move /sys   /.UP/union/sys
47 exec /bin/busybox switch_root /.UP/union /sbin/init
49 EOF
51 chmod 750 "${rootdir}/initrd/init"
53 # Make initramfs
54 cd -- "${rootdir}/initrd"
55 rm -f initrd.img
57 find . | sed 's!^./!!' | cpio -oC512 -H newc | \
58  lzip -9c --dictionary-size=16 > initrd.img