wok rev 18567

libgphoto2, udev: fix post_install()
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Nov 09 14:43:54 2015 +0200 (2015-11-09)
parents e4eed57a72a5
children d1bbe516c115
files libgphoto2/receipt udev/receipt
line diff
     1.1 --- a/libgphoto2/receipt	Mon Nov 09 14:00:27 2015 +0200
     1.2 +++ b/libgphoto2/receipt	Mon Nov 09 14:43:54 2015 +0200
     1.3 @@ -12,73 +12,78 @@
     1.4  TAGS="camera photo"
     1.5  
     1.6  DEPENDS="libexif jpeg libusb libusb-compat libltdl hal"
     1.7 -BUILD_DEPENDS="jpeg-dev libexif-dev libtool libexif jpeg libusb libusb-dev libusb-compat libusb-compat-dev pkg-config"
     1.8 +BUILD_DEPENDS="jpeg-dev libexif-dev libtool libexif jpeg libusb libusb-dev \
     1.9 +libusb-compat libusb-compat-dev pkg-config"
    1.10  
    1.11  # Rules to configure and make the package.
    1.12  compile_rules()
    1.13  {
    1.14 -   	cd $src
    1.15 -	./configure --prefix=/usr udevscriptdir=/lib/udev \
    1.16 -			--with-exif --disable-static $CONFIGURE_ARGS &&
    1.17 +	./configure \
    1.18 +		--prefix=/usr \
    1.19 +		udevscriptdir=/lib/udev \
    1.20 +		--with-exif \
    1.21 +		--disable-static \
    1.22 +		$CONFIGURE_ARGS &&
    1.23  	make &&
    1.24  	make install
    1.25 -	
    1.26  }
    1.27  
    1.28  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.29  genpkg_rules()
    1.30  {
    1.31 -    mkdir -p $fs/usr/lib/$PACKAGE $fs/usr/share \
    1.32 -	          $fs/lib \
    1.33 -			  $fs/usr/share/hal/fdi/information/20thirdparty \
    1.34 -			  $fs/etc/udev/rules.d
    1.35 +	mkdir -p \
    1.36 +		$fs/usr/lib/$PACKAGE \
    1.37 +		$fs/usr/share \
    1.38 +		$fs/lib \
    1.39 +		$fs/usr/share/hal/fdi/information/20thirdparty \
    1.40 +		$fs/etc/udev/rules.d
    1.41  	cp -a $install/usr/bin $fs/usr
    1.42  	cp -a $install/usr/lib/$PACKAGE $fs/usr/lib
    1.43  	cp -a $install/usr/lib/${PACKAGE}_port $fs/usr/lib
    1.44  	cp -a $install/usr/lib/*so* $fs/usr/lib
    1.45  	cp -a $install/usr/share/$PACKAGE $fs/usr/share
    1.46  	cp -a $install/lib/udev $fs/lib
    1.47 -		
    1.48 +
    1.49  	# rm all archive files
    1.50  	find $fs/usr/lib -name "*.*a" -exec rm -f {} \; 2> /dev/null
    1.51 -	
    1.52 +
    1.53  	# fix permissions
    1.54  	chmod +x $fs/lib/udev/check*
    1.55  	chmod +x $fs/usr/bin/gphoto2*
    1.56 -	
    1.57  }
    1.58  
    1.59  post_install()
    1.60  {
    1.61 -	local root
    1.62 -	root=$1
    1.63 -	
    1.64 -	HAL_FDI="$1/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi"
    1.65 -	UDEV_RULE="$1/etc/udev/rules.d/70-libgphoto2.rules"
    1.66 -	CAM_LIST="$1/usr/lib/libgphoto2/print-camera-list"
    1.67 +	local root=$1
    1.68 +
    1.69 +	HAL_FDI="$root/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi"
    1.70 +	UDEV_RULE="$root/etc/udev/rules.d/70-libgphoto2.rules"
    1.71 +	CAM_LIST="$root/usr/lib/libgphoto2/print-camera-list"
    1.72  
    1.73  	# Let print-camera-list find libgphoto2.so
    1.74 -	export LD_LIBRARY_PATH="$1/usr/lib"
    1.75 +	export LD_LIBRARY_PATH="$root/usr/lib"
    1.76  	# Let libgphoto2 find its camera-modules before running print-camera-list
    1.77 -	export CAMLIBS="$1/usr/lib/libgphoto2/$VERSION"
    1.78 +	export CAMLIBS="$root/usr/lib/libgphoto2/$VERSION"
    1.79  
    1.80  	# HAL file
    1.81  	"$CAM_LIST" hal-fdi > "$HAL_FDI" || return 1
    1.82 -  
    1.83 +
    1.84  	#udev rule
    1.85  	"$CAM_LIST" udev-rules version 0.98 group camera mode 0660 > "$UDEV_RULE" || return 1
    1.86 -	
    1.87 -	tazpkg reconfigure udev --root=$1
    1.88 -	
    1.89 +
    1.90 +	tazpkg reconfigure udev --root=$root
    1.91 +
    1.92  	# add group camera
    1.93 -	if ! grep -q camera $root/etc/group ; then
    1.94 -		addgroup -g 97 camera
    1.95 +	if ! grep -q camera $root/etc/group; then
    1.96 +		chroot "$1/" addgroup -g 97 camera
    1.97  	fi
    1.98 -	
    1.99 -	echo "Don't forget to add yourself to group camera to use libgphoto2: addgroup tux camera"
   1.100 +
   1.101 +	echo
   1.102 +	echo "Don't forget to add yourself to group camera to use libgphoto2:"
   1.103 +	echo "    # addgroup tux camera"
   1.104  }
   1.105  
   1.106  post_remove()
   1.107  {
   1.108 -	chroot "$1/" delgroup camera & >/dev/null
   1.109 +	chroot "$1/" delgroup camera
   1.110  }
     2.1 --- a/udev/receipt	Mon Nov 09 14:00:27 2015 +0200
     2.2 +++ b/udev/receipt	Mon Nov 09 14:43:54 2015 +0200
     2.3 @@ -85,19 +85,20 @@
     2.4  
     2.5  list_udev_group()
     2.6  {
     2.7 -    object=$2
     2.8 -    [ -n "$object" ] || object=GROUP
     2.9 -    grep $object $1/etc/udev/rules.d/* | \
    2.10 -        sed 's/.*GROUP="\([a-zA-Z0-9]*\)".*/\1/' | sort | uniq
    2.11 +	object=${2:-GROUP}
    2.12 +	grep $object $1/etc/udev/rules.d/* | \
    2.13 +	sed "s|.*$object=\"\([a-zA-Z0-9]*\)\".*|\1|" | sort | uniq
    2.14  }
    2.15  
    2.16  post_install()
    2.17  {
    2.18 -    # Sanity check for udev+ldap boot
    2.19 -    list_udev_group "$1" GROUP | while read x ; do
    2.20 -        grep -q ^$x: $1/etc/group || chroot $1/ addgroup -S $x
    2.21 -    done
    2.22 -    list_udev_group "$1" OWNER | while read x ; do
    2.23 -        grep -q ^$x: $1/etc/passwd || chroot $1/ adduser -S -D -H $x
    2.24 -    done
    2.25 +	# Sanity check for udev+ldap boot
    2.26 +	list_udev_group "$1" GROUP | \
    2.27 +	while read x; do
    2.28 +		grep -q ^$x: $1/etc/group || chroot $1/ addgroup -S $x
    2.29 +	done
    2.30 +	list_udev_group "$1" OWNER | \
    2.31 +	while read x; do
    2.32 +		grep -q ^$x: $1/etc/passwd || chroot $1/ adduser -S -D -H $x
    2.33 +	done
    2.34  }