-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfixoptware.sh
More file actions
executable file
·29 lines (25 loc) · 910 Bytes
/
Copy pathfixoptware.sh
File metadata and controls
executable file
·29 lines (25 loc) · 910 Bytes
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
#!/volume1/@optware/bin/bash
ln -s /volume1/@optware /opt
touch /etc/profile
if ! grep '^PATH=.*/opt/bin' /etc/profile >/dev/null 2>&1 ; then
echo "Modifying PATH in /etc/profile"
perl -pi -e 's/^(PATH=)(.*?)(?:\/opt\/s?bin:?)?(.*?)(?:\/opt\/s?bin:?)?(.*?)/\1\/opt\/sbin:\/opt\/bin:\2\3\4/' /etc/profile
#echo "PATH=/opt/sbin:/opt/bin:\$PATH" >> /etc/profile
#echo "export PATH" >> /etc/profile
fi
if ! grep "^alias ls='ls --color=auto'" /etc/profile >/dev/null 2>&1 ; then
echo "Adding ls alias to /etc/profile"
echo "alias ls='ls --color=auto'" >> /etc/profile
fi
if ! grep '^# Optware setup' /etc/rc.local >/dev/null 2>&1
then
echo "Modifying /etc/rc.local"
[ ! -e /etc/rc.local ] && echo "#!/bin/sh" >/etc/rc.local
sed -i -e '/^exit 0/d' /etc/rc.local
cat >>/etc/rc.local <<EOF
# Optware setup
[ -x /etc/rc.optware ] && /etc/rc.optware start
exit 0
EOF
chmod 755 /etc/rc.local
fi