wok view kismet/receipt @ rev 18730
Quote root dir in post_install
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Dec 20 15:13:45 2015 +0100 (2015-12-20) |
parents | 1067bb7f1e24 |
children | a78610b2eb47 |
line source
1 # SliTaz package receipt.
3 PACKAGE="kismet"
4 VERSION="2011-03-R2"
5 CATEGORY="network"
6 SHORT_DESC="Wireless network monitoring tool"
7 MAINTAINER="domcox@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://www.kismetwireless.net"
11 WGET_URL="http://www.kismetwireless.net/code/$TARBALL"
12 TAGS="wireless network monitor"
14 DEPENDS="dbus libnl libpcap ncurses pcre libcap attr"
15 BUILD_DEPENDS="pkg-config libpcap-dev ncurses-dev libnl-dev"
17 # Rules to configure and make the package.
18 compile_rules()
19 {
20 export LDFLAGS="$LDFLAGS -ltinfo"
21 touch -d 197001010000 .depend
22 ./configure \
23 --prefix=/usr \
24 --sysconfdir=/etc/kismet \
25 $CONFIGURE_ARGS && \
26 make && \
27 make DESTDIR=$DESTDIR install
28 }
30 # Rules to gen a SliTaz package suitable for Tazpkg.
31 genpkg_rules()
32 {
33 mkdir -p $fs/usr
34 cp -a $install/usr/bin $fs/usr
35 cp -a $src/kismet_capture $fs/usr/bin
36 mkdir -p $fs/etc
37 cp -a $install/etc/kismet $fs/etc
38 # do not overwrite existing configuration
39 mv $fs/etc/kismet/kismet.conf $fs/etc/kismet/kismet.conf.new
40 mv $fs/etc/kismet/kismet_drone.conf $fs/etc/kismet/kismet_drone.conf.new
41 }
43 post_install()
44 {
45 # addgroup kismet if needed
46 if ! grep -q kismet "$1/etc/group"; then
47 echo -n "Adding group kismet..."
48 chroot "$1/" addgroup -g 315 kismet
49 status
50 fi
51 # Add tux to kismet group
52 chroot "$1/" addgroup tux kismet
53 # set Kismet as suid-root
54 echo -n "Set Kismet as suid-root.."
55 chroot "$1/" chown root:kismet /usr/bin/kismet_capture && \
56 chroot "$1/" chmod 4550 /usr/bin/kismet_capture
57 status
58 # configuration files update
59 create=1
60 overwrite=2
61 keep=3
62 cd "$1/etc/kismet"
63 # kismet_ui.conf doesn't exists anymore
64 if [ -e kismet_ui.conf ]; then
65 mv kismet_ui.conf kismet_ui.oldpkg
66 fi
67 for file in "kismet" "kismet_drone"
68 do
69 # check current files version
70 if [ ! -e $file.conf ]; then
71 action=$create
72 else
73 current=`grep version= $file.conf`
74 new=`grep version= $file.conf.new`
75 if [ "$current" = "$new" ]; then
76 action=$keep
77 else
78 action=$overwrite
79 fi
80 fi
81 # update if needed
82 case $action in
83 $create)
84 mv $file.conf.new $file.conf
85 ;;
86 $keep)
87 rm $file.conf.new
88 warning="keep"
89 ;;
90 $overwrite)
91 mv $file.conf $file.conf.oldpkg
92 mv $file.conf.new $file.conf
93 warning=$overwrite
94 echo "Warning: /etc/kismet/$file.conf new version from upstream"
95 ;;
96 esac
97 done
98 if [ "$warning" != "keep" ]; then
99 echo "-----"
100 echo "You MUST edit etc/kismet/kismet.conf and configure Kismet"
101 echo "for your system, or it will NOT run properly!"
102 fi
103 true
104 }
106 post_remove()
107 {
108 delgroup kismet
109 rm -rf /etc/kismet
110 }