File: postrm

package info (click to toggle)
lshell 2.01-11
  • links: PTS
  • area: main
  • in suites: woody
  • size: 116 kB
  • ctags: 9
  • sloc: sh: 155; ansic: 141; makefile: 39
file content (45 lines) | stat: -rw-r--r-- 846 bytes parent folder | download
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
#! /bin/sh
set -e
sed -n '/^\//q;1,/^\//p' /etc/shells > /etc/shells.tmp

grep '^[[:space:]]*/' /etc/shells | 
while read shell
do
	dir=`dirname $shell`
	if [ "x`basename $dir`" != "xlshells" ]
	then
		echo $shell >> /etc/shells.tmp
	else
		echo "`dirname $dir`/`basename $shell`" >> /etc/shells.tmp
	fi
done

cp /etc/shells /etc/shells.old
cp /etc/shells.tmp /etc/shells
rm /etc/shells.tmp

cat /etc/passwd |
awk '{	FS=":"
	if ( $3 < 100 ) next
	if ( $7 == "" || $7 == "/bin/false" || $7 == "/bin/sync" ) next
	print $1,$7
     }' |
while read user shell
do
	grep -v $shell /etc/shells.old >/dev/null 2>&1
	if [ $? -eq 0 ]
	then
		dir=`dirname $shell`
	        if [ "x`basename $dir`" = "xlshells" ]
	        then
			shell="`dirname $dir`/`basename $shell`"
			chsh -s $shell $user
		fi
	fi
done

/bin/rm -f /etc/shells.old

#DEBHELPER#

exit 0