wok-6.x view kismet/receipt @ rev 24699
Add some current_version
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 13 19:47:29 2022 +0000 (2022-03-13) |
parents | 6e8b1bcb30e2 |
children |
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="https://www.kismetwireless.net"
11 WGET_URL="https://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 # What is the latest version available today?
18 current_version()
19 {
20 wget -O - ${WGET_URL%/*}/ 2>/dev/null | \
21 sed '/kismet-[0-9]/!d;/tar/!d;s|.*kismet-||;s|.tar.*||' | sort -Vr | sed q
22 }
24 # Rules to configure and make the package.
25 compile_rules()
26 {
27 export LDFLAGS="$LDFLAGS -ltinfo"
28 touch -d 197001010000 .depend
29 ./configure \
30 --prefix=/usr \
31 --sysconfdir=/etc/kismet \
32 $CONFIGURE_ARGS && \
33 make && \
34 make DESTDIR=$DESTDIR install
35 }
37 # Rules to gen a SliTaz package suitable for Tazpkg.
38 genpkg_rules()
39 {
40 mkdir -p $fs/usr
41 cp -a $install/usr/bin $fs/usr
42 cp -a $src/kismet_capture $fs/usr/bin
43 mkdir -p $fs/etc
44 cp -a $install/etc/kismet $fs/etc
45 # do not overwrite existing configuration
46 mv $fs/etc/kismet/kismet.conf $fs/etc/kismet/kismet.conf.new
47 mv $fs/etc/kismet/kismet_drone.conf $fs/etc/kismet/kismet_drone.conf.new
48 }
50 post_install()
51 {
52 # addgroup kismet if needed
53 if ! grep -q kismet "$1/etc/group"; then
54 echo -n "Adding group kismet..."
55 chroot "$1/" addgroup -g 315 kismet
56 status
57 fi
58 # Add tux to kismet group
59 chroot "$1/" addgroup tux kismet
60 # set Kismet as suid-root
61 echo -n "Set Kismet as suid-root.."
62 chroot "$1/" chown root:kismet /usr/bin/kismet_capture && \
63 chroot "$1/" chmod 4550 /usr/bin/kismet_capture
64 status
65 # configuration files update
66 create=1
67 overwrite=2
68 keep=3
69 cd "$1/etc/kismet"
70 # kismet_ui.conf doesn't exists anymore
71 if [ -e kismet_ui.conf ]; then
72 mv kismet_ui.conf kismet_ui.oldpkg
73 fi
74 for file in "kismet" "kismet_drone"
75 do
76 # check current files version
77 if [ ! -e $file.conf ]; then
78 action=$create
79 else
80 current=`grep version= $file.conf`
81 new=`grep version= $file.conf.new`
82 if [ "$current" = "$new" ]; then
83 action=$keep
84 else
85 action=$overwrite
86 fi
87 fi
88 # update if needed
89 case $action in
90 $create)
91 mv $file.conf.new $file.conf
92 ;;
93 $keep)
94 rm $file.conf.new
95 warning="keep"
96 ;;
97 $overwrite)
98 mv $file.conf $file.conf.oldpkg
99 mv $file.conf.new $file.conf
100 warning=$overwrite
101 echo "Warning: /etc/kismet/$file.conf new version from upstream"
102 ;;
103 esac
104 done
105 if [ "$warning" != "keep" ]; then
106 echo "-----"
107 echo "You MUST edit etc/kismet/kismet.conf and configure Kismet"
108 echo "for your system, or it will NOT run properly!"
109 fi
110 true
111 }
113 post_remove()
114 {
115 delgroup kismet
116 rm -rf /etc/kismet
117 }