-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·107 lines (90 loc) · 2.97 KB
/
setup.sh
File metadata and controls
executable file
·107 lines (90 loc) · 2.97 KB
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
103
104
105
106
107
#!/bin/bash
# Installs keytest
if [ "$USER" != root ]
then
echo Need to be root to install, but USER="$USER"
exit 1
fi
mkdir out
chgrp keytest out
chmod g+rw keytest out
mkdir /var/cache/keytest
if [ -z "$SUDO_USER" ]
then
echo we would like to chmod /var/cache/keytest to be the SUDO_USER, but we do not seem to have been run from sudo
else
chown $SUDO_USER /var/cache/keytest
chown $SUDO_USER out
fi
KT=`dirname "$0"`
# I haven't tested whether this will work on an RPM based distro. Easy to fix though.
apt-get install xserver-xephyr xclip xvkbd wmctrl xvfb libqt4-dbg icewm || #svn pylint
yum install xserver-xephyr xclip xvkbd wmctrl xvfb libqt4-dbg icewm
adduser keytest < /dev/null
adduser keytest2 < /dev/null
addgroup keytest2 keytest
addgroup $SUDO_USER keytest
addgroup $SUDO_USER keytest2
if ! grep keytest /etc/sudoers
then
echo allowing admin users to switch to keytest user
echo '%adm ALL =(keytest,keytest2) NOPASSWD: ALL' >> /etc/sudoers
fi
# cat /mnt/jaunty/etc/cups/printers.conf |grep -o '[^ ]*>$' |grep -v '^<'| sed 's/>$//'
#we should really handle each printer seperately, but this will work if they are similar
if grep AllowUser /etc/cups/printers.conf
then
echo printer: using whitelisting, nothings needs be done.
exit
fi
if grep -v "^DenyUser keytest$" /etc/cups/printers.conf | grep DenyUser /etc/cups/printers.conf
then
echo There are already denied users. We do not support this yet, exiting
exit
fi
#(cd /etc/cups/ppd/ && ls *.ppd) | sed s/.ppd$// | while read L
cat /etc/cups/printers.conf |grep -o '[^ ]*>$' |grep -v '^<'| sed 's/>$//' | while read L
do
echo $L
echo lpadmin -p $L -u deny:keytest,keytest2
lpadmin -p $L -u deny:keytest,keytest2
done
# change this to true to install this as a service
if false
then
#Warning, this code has not been tested
cp $KT/S99keytest /etc/init.d/keytest # This may not work on redhat
chown root /etc/init.d/keytest
chmod 755 /etc/init.d/keytest
for RC in 2 3 4 5
do
rm /etc/rc$RC.d/S99keytest
ln -s /etc/init.d/keytest /etc/rc$RC.d/S99keytest
done
mkdir -p /etc/keytest
(cd $KT; pwd) > /etc/keytest/dir
fi
# Is noatime enabled by default now?
if false # ! mount | egrep ' / .*(rel|no)atime'
then
echo -----------------------------------------
echo - WARNING!!!!
echo - It appears that relatime is not enabled on your root partition
echo - This means that every time you access a file, metadata will be updated
echo - Keytest reads a *lot* of files
echo - Unless you enable relatime or noatime, running keytest will
echo - * Greatly slow down your forground tasks.
echo - * Increase the wear and tear on your harddisk
echo -----------------------------------------
fi
echo
if [ ! -e local_keytest.rc ]
then
echo local_keytest.rc does not exist. Copy from local_keytest.rc.example and customise!!!
fi
if [ ! -e shared_variables.sh ]
then
echo shared_variables.sh does not exist!!!
echo " " Copy and customise one of: shared_variables-*.sh
fi
sudo -u keytest ./commands.sh add_autokill_crontab