tazpkg view modules/block @ rev 849
Fix working of modules/reconfigure (thank Robertux for bugreport); small changes.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Oct 20 10:24:52 2015 +0300 (2015-10-20) |
parents | a02e36d44d06 |
children | 688515d746e1 |
line source
1 #!/bin/sh
2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
3 # block - TazPkg module
4 # Change package's blocked status
7 # Connect function libraries
8 . /lib/libtaz.sh
10 # Get TazPkg working environment
11 . @@MODULES@@/getenv
16 newline
17 if [ ! -d "$INSTALLED/$2" ]; then
18 _ 'Package "%s" is not installed.' "$2"
19 exit 1
20 fi
22 case $1 in
24 block|-b)
25 # Block package
26 if grep -qs "^$2" "$BLOCKED"; then
27 _ 'Package "%s" is already blocked.' "$2"
28 else
29 echo "$2" >> "$BLOCKED"
30 # Log this activity
31 . "$INSTALLED/$2/receipt"; tazpkg call log_pkg Blocked
32 _ 'Package "%s" blocked.' "$2"
33 fi
34 ;;
37 unblock|-u)
38 # Unblock package
39 if grep -qs "^$2" "$BLOCKED"; then
40 sed -i "/^$2\$/d" "$BLOCKED"
41 # Log this activity
42 . "$INSTALLED/$2/receipt"; tazpkg call log_pkg Unblocked
43 _ 'Package "%s" unblocked.' "$2"
44 else
45 _ 'Package "%s" is not blocked.' "$2"
46 fi
47 ;;
50 chblock)
51 # Block/unblock package
52 if grep -qs "^$2" "$BLOCKED"; then
53 sed -i "/^$2\$/d" "$BLOCKED"
54 # Log this activity
55 . "$INSTALLED/$2/receipt"; tazpkg call log_pkg Unblocked
56 _ 'Package "%s" unblocked.' "$2"
57 else
58 echo "$2" >> "$BLOCKED"
59 # Log this activity
60 . "$INSTALLED/$2/receipt"; tazpkg call log_pkg Blocked
61 _ 'Package "%s" blocked.' "$2"
62 fi
63 ;;
65 esac
66 newline