-
Notifications
You must be signed in to change notification settings - Fork 11
/
system-init.sh
executable file
·45 lines (41 loc) · 1.23 KB
/
system-init.sh
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
#!/bin/bash
### BEGIN INIT INFO
# Provides: slitaz.cn
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: self define auto start
# Description: self define auto start
### END INIT INFO
if [ ! -f /etc/first_init ]
then
resize2fs /dev/mmcblk0p6 &
sudomainid=`date +%s%N | md5sum | cut -c 1-5`
sshport=`head -10 /dev/urandom | cksum | cut -c 1-5`
sed -i "s/xxxxx/$sudomainid/g" /etc/frp/frpc.ini
sed -i "s/ppppp/$sshport/g" /etc/frp/frpc.ini
sed -i "s/xxxxx/$sudomainid/g" /var/www/html/zhinan.html
sed -i "s/xxxxx/$sudomainid/g" /var/www/html/index2.html
dmesg | grep "CPU: hi" | awk -F ':[ ]' '/CPU/{printf ($2)}' > /etc/regname
fi
if [ ! -f /etc/first_init ]
then
echo "resize2fs /dev/mmcblk0p6" > /etc/first_init
fi
if [ ! -f /swapfile ]
then
{
dd if=/dev/zero of=/swapfile bs=1M count=512
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
} &
fi
grep -q '/swapfile' /etc/fstab || echo "/swapfile swap swap defaults,nofail 0 0" >> /etc/fstab
echo "/sbin/automount" > /sys/kernel/uevent_helper
/sbin/automount -a &
/sbin/net_status &
/sbin/vlmcsd &
echo 42 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio42/direction