-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.hr
98 lines (80 loc) · 2.87 KB
/
init.hr
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
#!/bin/sh
################################################################################
#
# Generic ramdisk init process for booting a device. Based Marko Saukko's
# initrd for Galaxy Note GT-i9250. Reworked by Roberto A. Foglietta.
#
# Copyright (C) 2013-2015 Jolla Ltd.
# Originally written by Andrea Bernabei
# Contact: Igor Zhbanov <[email protected]>
#
# Copyright (C) 2023 Roberto A. Foglietta
# Contact: [email protected]
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
################################################################################
# release: 0.1.4
usb_info() {
echo "############ usb_info: $1 ##############"
write $G_USB_ISERIAL "$1"
}
if false; then #################################################################
#Run mdev
echo "Running mdev..."
mdev -s
#Set mdev as hotplug manager
echo /bin/mdev > /proc/sys/kernel/hotplug
fi #############################################################################
if [ -s /etc/sysconfig/display ]; then
set -o allexport
. /etc/sysconfig/display
set +o allexport
fi
if [ -n "$DISPLAY_BRIGHTNESS_PATH" -a -n "$DISPLAY_BRIGHTNESS" ]; then
write $DISPLAY_BRIGHTNESS_PATH $((DISPLAY_BRIGHTNESS / 2))
fi
ip link set usb0 up
ip link set rndis0 up
if ipaddr add $LOCAL_IP/24 broadcast $LOCAL_BR dev rndis0 ; then
USB_IFACE=rndis0
elif ipaddr add $LOCAL_IP/24 broadcast $LOCAL_BR dev usb0 ; then
USB_IFACE=usb0
else
usb_info "recovery: error, could not setup USB as usb0 or rndis0."
dmesg
sleep 60 # plenty long enough to check usb on host
reboot -f
fi
ipaddr add $USB_IP/24 broadcast $USB_BR dev $USB_IFACE label rndis0:0
echo V > /dev/watchdog
yes recovery | passwd root
for i in passwd group shadow; do
cp -arf /etc/$i /etc/${i}-
done
sed -i "s/@IFACE@/$USB_IFACE/g" /etc/udhcpd.conf
udhcpd
usb_info "recovery: telnet on $USB_IFACE $LOCAL_IP running udhcpd"
# Remove recovery-menu lock if the /var/run is not on tmpfs.
remove_lock
echo "Starting telnetd..."
telnetd -K -l /usr/bin/recovery-menu.sh
sshd_execution noblock
#yamui -t "recovery: connect USB cable and telnet to $LOCAL_IP" &
yamui_banner_logo init
# RAF, TODO: what is for this?
echo "Starting yamui-screensaverd..."
/usr/bin/yamui-screensaverd &
# RAF, TODO: check why this line
while true; do sleep 86400; done