-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·88 lines (67 loc) · 1.89 KB
/
setup.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
#!/bin/bash
. /opt/farm/scripts/init
setup_midnight_commander_for_user() {
file=$1
path=$2
user=$3
group=`id -gn $user`
home=`getent passwd $user |cut -d: -f 6`
if [ "$OSTYPE" = "freebsd" ]; then
wrapper=/usr/local/libexec/mc/mc-wrapper.sh
elif [ "$OSTYPE" = "netbsd" ]; then
wrapper=/usr/pkg/libexec/mc/mc-wrapper.sh
elif [ "$OSTYPE" = "suse" ]; then
wrapper=/usr/share/mc/mc-wrapper.sh
else
wrapper=/usr/share/mc/bin/mc-wrapper.sh
fi
if [ -d $home ]; then
mkdir -p `dirname $home/$path`
cp -f $file $home/$path
chown $user:$group $home/$path
rc=$home/.bashrc
if [ ! -f $rc ]; then
touch $rc
fi
if [ "`grep 'alias mc' $rc`" = "" ] && [ -f $wrapper ]; then
echo >>$rc
echo "alias mc='. $wrapper'" >>$rc
fi
if [ "`grep mcedit $rc`" = "" ]; then
echo >>$rc
echo "export EDITOR=mcedit" >>$rc
fi
fi
}
/opt/farm/ext/packages/utils/install.sh mc
base=/opt/farm/ext/mc-black/templates/$OSVER
if [ -f $base/mc.ini ]; then
echo "setting up midnight commander profiles"
if [ -f $base/mc.skin ]; then
if [ "$OSTYPE" = "freebsd" ]; then
cp -f $base/mc.skin /usr/local/share/mc/skins/wheezy.ini
elif [ "$OSTYPE" = "netbsd" ]; then
cp -f $base/mc.skin /usr/pkg/share/mc/skins/wheezy.ini
else
cp -f $base/mc.skin /usr/share/mc/skins/wheezy.ini
fi
fi
if grep -qFx $OSVER /opt/farm/ext/mc-black/config/oldpaths.conf; then
SUB=".mc/ini"
else
SUB=".config/mc/ini"
fi
setup_midnight_commander_for_user $base/mc.ini $SUB root
if [ "`getent passwd ubuntu`" != "" ]; then
setup_midnight_commander_for_user $base/mc.ini $SUB ubuntu
fi
ADMIN=`/opt/farm/config/get-primary-admin-account.sh`
if [ "`getent passwd $ADMIN`" != "" ]; then
setup_midnight_commander_for_user $base/mc.ini $SUB $ADMIN
fi
fi
loc="/usr/share/locale/pl/LC_MESSAGES"
if [ -f $loc/mc.mo ]; then
echo "disabling midnight commander polish translation"
mv $loc/mc.mo $loc/midc.mo
fi