-
Notifications
You must be signed in to change notification settings - Fork 2
/
post-build.sh
102 lines (85 loc) · 3.19 KB
/
post-build.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
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
#!/bin/sh
set -u
set -e
# Add a console on tty1
if [ -e ${TARGET_DIR}/etc/inittab ]; then
grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
sed -i '/GENERIC_SERIAL/a\
tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab
fi
#############################################################################################################################################
## PermitRootLogin for ssh
sed -i '/#PermitRootLogin prohibit-password/c\PermitRootLogin yes' output/target/etc/ssh/sshd_config
## change prompt to raspi> with red color
sed -i "/export PS1=/c\ export PS1='\\\e[0;31mraspi> \\\e[m '" output/target/etc/profile
## aliasing ls -lah
echo 'alias las="ls -lah"' >> output/target/etc/profile
if [ ! -d "${TARGET_DIR}/root/superMusic" ]; then
sudo mkdir ${TARGET_DIR}/root/superMusic
fi
sudo cp $(dirname $0)/playmusic/S50-playmusic-daemon-service ${TARGET_DIR}/etc/init.d/
sudo chmod 777 ${TARGET_DIR}/etc/init.d/S50-playmusic-daemon-service
sudo cp $(dirname $0)/playmusic/playmusic* ${TARGET_DIR}/root/superMusic/
sudo cp $(dirname $0)/playmusic/*.mp3 ${TARGET_DIR}/root/superMusic/
sudo cp $(dirname $0)/playmusic/detectUSB ${TARGET_DIR}/root/superMusic/
sudo cp $(dirname $0)/playmusic/startBluetooth ${TARGET_DIR}/root/superMusic/
sudo chmod -R 777 ${TARGET_DIR}/root
## Install music
################# Enabling Wifi #######################################
if [ ! -d "${TARGET_DIR}/etc/wpa_supplicant" ]; then
sudo mkdir ${TARGET_DIR}/etc/wpa_supplicant
fi
sudo chmod 777 ${TARGET_DIR}/etc/wpa_supplicant
if [ ! -f "${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" ]; then
sudo touch ${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant.conf
fi
sudo chmod 777 ${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant.conf
sudo cp package/busybox/S10mdev ${TARGET_DIR}/etc/init.d/S10mdev
sudo chmod 777 ${TARGET_DIR}/etc/init.d/S10mdev
sudo cp package/busybox/mdev.conf ${TARGET_DIR}/etc/mdev.conf
sudo chmod 777 ${TARGET_DIR}/etc/mdev.conf
## make static ip
cat > output/target/etc/network/interfaces << EOL
# interface file auto-generated by buildroot
auto lo
iface lo inet loopback
auto eth0
#uncomment all commented lines if you wanna ssh over ethernet cable
iface eth0 inet dhcp
#iface eth0 inet static
pre-up /etc/network/nfs_check
#address 192.168.1.200 ##you must comment all this lines if you wanna ssh over wifi
#netmask 255.255.255.0
wait-delay 15
#hostname $(hostname)
auto wlan0
iface wlan0 inet static
address 192.168.1.201
netmask 255.255.255.0
pre-up wpa_supplicant -B -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant
wait-delay 15
iface default inet dhcp
EOL
cat > output/target/etc/wpa_supplicant/wpa_supplicant.conf << EOL
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="Joe"
scan_ssid=1
proto=RSN WPA
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
auth_alg=OPEN
priority=0
id_str="name"
psk="23121973janet"
}
network={
ssid="ITI_Students"
psk="ITI_1234"
key_mgmt=WPA-PSK
}
EOL