Browse code

First commit

Qurban Ullah authored on 27/02/2018 18:08:17
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,56 @@
1
+AVOUCH=/run/media/qurbanullah/c347a0f7-2a5b-4dc8-89ab-6d8e005c3b52
2
+cd $AVOUCH
3
+
4
+# creating directories onto which the file systems will be mounted
5
+mkdir -pv $AVOUCH/{dev,proc,sys,run}
6
+
7
+# Creating Initial Device Nodes
8
+mknod -m 600 $AVOUCH/dev/console c 5 1
9
+mknod -m 666 $AVOUCH/dev/null c 1 3
10
+
11
+# Mounting and Populating /dev
12
+mount -v --bind /dev $AVOUCH/dev
13
+
14
+# mount the remaining virtual kernel filesystems
15
+mount -vt devpts devpts $AVOUCH/dev/pts -o gid=5,mode=620
16
+mount -vt proc proc $AVOUCH/proc
17
+mount -vt sysfs sysfs $AVOUCH/sys
18
+mount -vt tmpfs tmpfs $AVOUCH/run
19
+
20
+if [ -h $AVOUCH/dev/shm ]; then
21
+  mkdir -pv $AVOUCH/$(readlink $AVOUCH/dev/shm)
22
+fi
23
+
24
+# /usr chroot
25
+chroot "$AVOUCH" /usr/bin/env -i \
26
+HOME=/root \
27
+TERM="$TERM" \
28
+PS1='\u:\w\$ ' \
29
+PATH=/bin:/usr/bin:/sbin:/usr/sbin \
30
+/usr/bin/bash --login +h
31
+
32
+
33
+# /tools chroot
34
+chroot "$AVOUCH" /tools/bin/env -i \
35
+HOME=/root \
36
+TERM="$TERM" \
37
+PS1='\u:\w\$ ' \
38
+PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
39
+/tools/bin/bash --login +h
40
+
41
+# Creating Essential Files and Symlinks
42
+ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
43
+ln -sv /tools/bin/perl /usr/bin
44
+ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
45
+ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
46
+sed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la
47
+ln -sv bash /bin/sh
48
+
49
+exec /tools/bin/bash --login +h
50
+
51
+touch /var/log/{btmp,lastlog,wtmp}
52
+chgrp -v utmp /var/log/lastlog
53
+chmod -v 664  /var/log/lastlog
54
+chmod -v 600  /var/log/btmp
55
+
56
+