wok-next view get-wfica/stuff/get-wfica @ rev 16263
ARM: add yad and slitaz-boxes
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Apr 05 08:48:26 2014 +0200 (2014-04-05) |
parents | cfdc18273610 |
children |
line source
1 #!/bin/sh -e
3 PACKAGE="wfica"
4 WEB_SITE="http://www.citrix.com"
5 PROD="productId=1689163&ntref=downloadreceiver&downloadId="
6 DLID="2323812"
7 INSTALL_USB=yes
9 ROOT="$1"
10 [ -d "$ROOT" ] || ROOT=""
12 if test $(id -u) != 0 ; then
13 echo -e "\nYou must be root to run `basename $0`."
14 echo -e "Please type 'su' and root password to become super-user.\n"
15 exit 0
16 fi
18 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
19 [ -n "$ROOT" ] && exit 1
20 tazpkg remove $PACKAGE
21 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
22 fi
24 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
25 CUR_DIR=$(pwd)
26 mkdir -p $TMP_DIR && cd $TMP_DIR
28 for i in $@ $DLID; do
29 [ -z "$(echo $i | sed 's/[0-9]//g')" ] && break
30 done
31 url="$WEB_SITE/English/ss/downloads/details.asp?$PROD$i"
32 filter="/Download/h;/\.deb/!d;g;s/.*([\"']\([^\"']*\).*/\1/;q"
33 URL="$(wget -O - "$url" | sed "$filter")"
34 if [ -n "$URL" ]; then
35 URL="$WEB_SITE$URL"
36 USB_URL="$WEB_SITE$(wget -O - "$url" | sed "1,/\.deb/d;$filter")"
37 else
38 cat 2>&1 <<EOT
39 DownloadId $i not found on $WEB_SITE.
40 Try again with the correct downloadId :
41 # $0 <downloadId>
42 EOT
43 exit 1
44 fi
46 wget -O $PACKAGE.deb "$URL"
47 mkdir $PACKAGE
48 dpkg-deb -e $PACKAGE.deb $PACKAGE/meta
49 dpkg-deb -x $PACKAGE.deb $PACKAGE/fs
50 rm -f $PACKAGE.deb
51 sed '/^Description:/,$!d;s/^Description://' \
52 < $PACKAGE/meta/control > $PACKAGE/description.txt
54 SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
55 MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
56 VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
57 mv $PACKAGE $PACKAGE-$VERSION
59 cd $PACKAGE-$VERSION/fs
60 mkdir -p usr/share/applications usr/bin
61 ICAROOT=/opt/Citrix/ICAClient
62 cat > usr/bin/wfica_assoc.sh <<EOT
63 #!/bin/sh
65 ICAROOT=$ICAROOT
66 export ICAROOT
67 \$ICAROOT/wfica -associate -fileparam \$1
68 EOT
69 cat > usr/bin/wfica.sh <<EOT
70 #!/bin/sh
72 ICAROOT=$ICAROOT
73 export ICAROOT
74 \$ICAROOT/wfica -file \$1
75 EOT
76 chmod +x usr/bin/wfica.sh usr/bin/wfica_assoc.sh
77 cat > usr/share/applications/wfcmgr.desktop <<EOT
78 [Desktop Entry]
79 Encoding=UTF-8
80 Version=1.0
81 Type=Application
82 Name=Citrix Receiver
83 Icon=manager
84 TryExec=$ICAROOT/wfcmgr
85 Exec=$ICAROOT/wfcmgr -icaroot $ICAROOT
86 Terminal=false
87 Categories=Application;Network
88 EOT
89 ln -s $ICAROOT/wfica usr/bin
90 ln -s $ICAROOT/wfcmgr usr/bin
92 if [ "$INSTALL_USB" == "yes" ]; then
93 wget -O .$ICAROOT/ctxusb.deb "$USB_URL"
94 dpkg-deb -x .$ICAROOT/ctxusb*.deb .
95 chmod 500 .$ICAROOT/ctxusbd
96 chmod 4555 .$ICAROOT/ctxusb
97 chmod 444 .$ICAROOT/usb.conf
98 chmod 700 etc/init.d/ctxusbd
99 [ -s .$ICAROOT/config/module.ini ] ||
100 cat > .$ICAROOT/config/module.ini <<EOT
101 [File Type Associations]
102 [KeyboardLayout]
103 [KeyboardType]
104 EOT
105 sed -i -e 's/^[ \t]*VirtualDriver[ \t]*=.*$/&, GenericUSB/' \
106 -e '/\[ICA 3.0\]/a\GenericUSB=on' .$ICAROOT/config/module.ini
107 cat >> .$ICAROOT/config/module.ini <<EOT
108 [GenericUSB]
109 DriverName = VDGUSB.DLL
110 EOT
111 fi
113 cd ../..
115 cat > $PACKAGE-$VERSION/receipt <<EOT
116 # SliTaz package receipt.
118 PACKAGE="$PACKAGE"
119 VERSION="$VERSION"
120 CATEGORY="non-free"
121 SHORT_DESC="$SHORT_DESC"
122 MAINTAINER="$MAINTAINER"
123 DEPENDS="openmotif"
124 SUGGESTED="glib gstreamer speex libvorbis"
125 WEB_SITE="$WEB_SITE/"
126 CONFIG_FILES="$ICAROOT/config $ICAROOT/nls"
127 EOT
129 # Pack
130 tazpkg pack $PACKAGE-$VERSION
132 # Clean to save RAM memory
133 rm -rf $PACKAGE-$VERSION
135 # Install pseudo package
136 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
137 case " $@ " in
138 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
139 esac
141 # Clean
142 cd $CUR_DIR
143 rm -rf $TMP_DIR