-
Notifications
You must be signed in to change notification settings - Fork 1
/
debian buster install
127 lines (121 loc) · 3.23 KB
/
debian buster install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#Для работы необходимо поставить entware
#You need entware installed on dune
#Установка производится в папку /opt
#Installing in /opt folder
#Скачиваем дистр
#Download debian
cd /opt
wget -c -O debian_buster-10.11-armhf_clean.tgz http://bit.ly/3AnQBaR
tar -xvzf ./debian_buster-10.11-armhf_clean.tgz
#Создаем файл для автостарта процессов в дебиане
#create autorun file for debian custom processes
touch /opt/etc/chroot-services.list
#добавялем автозапуск дебиана
#create autostart file for debian chroot
#Можно так же прописать внешнюю папку для доступа из под дебиана см EXT_DIR
#You can add custom mount from basic OS to debian, see EXT_DIR
cat > /opt/etc/init.d/S99debian << 'EOF'
#!/bin/sh
PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin
# Folder with Debian Stretch
CHROOT_DIR=/opt/debian
# Some folder outside of sandbox,
# will be mounted to /mnt folder in Debian
# Uncommented "EXT_DIR=" line if you need to
# mount a folder inside debian (remove #)
# EXT_DIR=/storage/6b73905f-67bc-4d52-b717-91a537cd4427/Film
CHROOT_SERVICES_LIST=/opt/etc/chroot-services.list
if [ ! -e "$CHROOT_SERVICES_LIST" ]; then
echo "Please, define Debian services to start in
$CHROOT_SERVICES_LIST first!"
echo "One service per line. Hint: this is a script names from
Debian's /etc/init.d/"
exit 1
fi
MountedDirCount="$(mount | grep $CHROOT_DIR | wc -l)"
start() {
if [ $MountedDirCount -gt 0 ]; then
echo "Chroot'ed services seems to be already started,
exiting..."
exit 1
fi
echo "Starting chroot'ed Debian services..."
for dir in dev proc sys; do
mount -o bind /$dir $CHROOT_DIR/$dir
done
[ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt
for item in $(cat $CHROOT_SERVICES_LIST); do
chroot $CHROOT_DIR /etc/init.d/$item start
done
}
stop() {
if [ $MountedDirCount -eq 0 ]; then
echo "Chroot'ed services seems to be already stopped,
exiting..."
exit 1
fi
echo "Stopping chroot'ed Debian services..."
for item in $(cat $CHROOT_SERVICES_LIST); do
chroot $CHROOT_DIR /etc/init.d/$item stop
sleep 2
done
mount | grep $CHROOT_DIR | awk '{print $3}' | xargs umount -l
}
restart() {
if [ $MountedDirCount -eq 0 ]; then
echo "Chroot'ed services seems to be already stopped"
start
else
echo "Stopping chroot'ed Debian services..."
for item in $(cat $CHROOT_SERVICES_LIST); do
chroot $CHROOT_DIR /etc/init.d/$item stop
sleep 2
done
mount | grep $CHROOT_DIR | awk '{print $3}' | xargs umount -l
echo "Restarting chroot'ed Debian services..."
for dir in dev proc sys; do
mount -o bind /$dir $CHROOT_DIR/$dir
done
mount -o bind /dev/pts $CHROOT_DIR/dev/pts
[ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt
for item in $(cat $CHROOT_SERVICES_LIST); do
chroot $CHROOT_DIR /etc/init.d/$item start
done
fi
}
enter() {
df | grep /opt/debian
if [ $? -eq 0 ]
then
chroot /opt/debian /bin/bash
else
echo "Debian not started"
exit 0
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
enter)
enter
;;
status) status
;;
*)
echo "Usage: (start|stop|restart|enter|status)"
exit 1
;;
esac
echo Done.
exit 0
EOF
chmod 755 /opt/etc/init.d/S99debian
ln -s /opt/etc/init.d/S99debian /opt/bin/debian
debian start