wok-stable view get-wfica/stuff/get-wfica @ rev 12322

get-wfica: update (thanks Carl)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 22 18:22:54 2012 +0200 (2012-08-22)
parents 80161a03ce21
children
line source
1 #!/bin/sh -e
3 PACKAGE="wfica"
4 WEB_SITE="http://www.citrix.com"
5 PROD="downloadId=2323812&productId=1689163&ntref=downloadreceiver"
6 INSTALL_USB=yes
8 ROOT="$1"
9 [ -d "$ROOT" ] || ROOT=""
11 if test $(id -u) != 0 ; then
12 echo -e "\nYou must be root to run `basename $0`."
13 echo -e "Please type 'su' and root password to become super-user.\n"
14 exit 0
15 fi
17 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
18 [ -n "$ROOT" ] && exit 1
19 tazpkg remove $PACKAGE
20 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
21 fi
23 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
24 CUR_DIR=$(pwd)
25 mkdir -p $TMP_DIR && cd $TMP_DIR
27 URL="$WEB_SITE$(wget -O - "$WEB_SITE/English/ss/downloads/details.asp?$PROD" | \
28 sed "/Download/h;/\.deb/!d;g;s/.*([\"']\([^\"']*\).*/\1/;q")"
29 USB_URL="$WEB_SITE$(wget -O - "$WEB_SITE/English/ss/downloads/details.asp?$PROD" | \
30 sed "1,/\.deb/d;/Download/h;/\.deb/!d;g;s/.*([\"']\([^\"']*\).*/\1/;q")"
32 wget -O $PACKAGE.deb "$URL"
33 mkdir $PACKAGE
34 dpkg-deb -e $PACKAGE.deb $PACKAGE/meta
35 dpkg-deb -x $PACKAGE.deb $PACKAGE/fs
36 rm -f $PACKAGE.deb
37 sed '/^Description:/,$!d;s/^Description://' \
38 < $PACKAGE/meta/control > $PACKAGE/description.txt
40 SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
41 MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
42 VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
43 mv $PACKAGE $PACKAGE-$VERSION
45 cd $PACKAGE-$VERSION/fs
46 mkdir -p usr/share/applications usr/bin
47 ICAROOT=/opt/Citrix/ICAClient
48 cat > usr/bin/wfica_assoc.sh <<EOT
49 #!/bin/sh
51 ICAROOT=$ICAROOT
52 export ICAROOT
53 \$ICAROOT/wfica -associate -fileparam \$1
54 EOT
55 cat > usr/bin/wfica.sh <<EOT
56 #!/bin/sh
58 ICAROOT=$ICAROOT
59 export ICAROOT
60 \$ICAROOT/wfica -file \$1
61 EOT
62 chmod +x usr/bin/wfica.sh usr/bin/wfica_assoc.sh
63 cat > usr/share/applications/wfcmgr.desktop <<EOT
64 [Desktop Entry]
65 Encoding=UTF-8
66 Version=1.0
67 Type=Application
68 Name=Citrix Receiver
69 Icon=manager
70 TryExec=$ICAROOT/wfcmgr
71 Exec=$ICAROOT/wfcmgr -icaroot $ICAROOT
72 Terminal=false
73 Categories=Application;Network
74 EOT
75 ln -s $ICAROOT/wfica usr/bin
76 ln -s $ICAROOT/wfcmgr usr/bin
78 if [ "$INSTALL_USB" == "yes" ]; then
79 wget -O .$ICAROOT/ctxusb.deb "$USB_URL"
80 dpkg-deb -x .$ICAROOT/ctxusb*.deb .
81 chmod 500 .$ICAROOT/ctxusbd
82 chmod 4555 .$ICAROOT/ctxusb
83 chmod 444 .$ICAROOT/usb.conf
84 chmod 700 etc/init.d/ctxusbd
85 [ -s .$ICAROOT/config/module.ini ] ||
86 cat > .$ICAROOT/config/module.ini <<EOT
87 [File Type Associations]
88 [KeyboardLayout]
89 [KeyboardType]
90 EOT
91 sed -i -e 's/^[ \t]*VirtualDriver[ \t]*=.*$/&, GenericUSB/' \
92 -e '/\[ICA 3.0\]/a\GenericUSB=on' .$ICAROOT/config/module.ini
93 cat >> .$ICAROOT/config/module.ini <<EOT
94 [GenericUSB]
95 DriverName = VDGUSB.DLL
96 EOT
97 fi
99 cd ../..
101 cat > $PACKAGE-$VERSION/receipt <<EOT
102 # SliTaz package receipt.
104 PACKAGE="$PACKAGE"
105 VERSION="$VERSION"
106 CATEGORY="non-free"
107 SHORT_DESC="$SHORT_DESC"
108 MAINTAINER="$MAINTAINER"
109 DEPENDS="openmotif"
110 SUGGESTED="glib gstreamer speex libvorbis"
111 WEB_SITE="$WEB_SITE/"
112 CONFIG_FILES="$ICAROOT/config $ICAROOT/nls"
113 EOT
115 # Pack
116 tazpkg pack $PACKAGE-$VERSION
118 # Clean to save RAM memory
119 rm -rf $PACKAGE-$VERSION
121 # Install pseudo package
122 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
123 case " $@ " in
124 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
125 esac
127 # Clean
128 cd $CUR_DIR
129 rm -rf $TMP_DIR