wok-tiny view fbvnc-config/receipt @ rev 142

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Feb 27 17:43:23 2019 +0100 (6 months ago)
parents c82d2b7a51b4
children
line source
1 # SliTaz package receipt.
3 PACKAGE="fbvnc-config"
4 VERSION="1.0"
5 CATEGORY="meta"
6 GROUP="network"
7 SHORT_DESC="VNC client configuration"
8 MAINTAINER="pascal.bellard@slitaz.org"
9 LICENSE="BSD"
10 WEB_SITE="http://tiny.slitaz.org/"
11 DEPENDS="base-tiny"
13 # Rules to gen a SliTaz package suitable for Tazpkg.
14 genpkg_rules()
15 {
16 mkdir -p $fs/etc
17 }
19 config_form()
20 {
21 case "$START" in
22 no|yes|ask) ;;
23 *) START="cmdline" ;;
24 esac
25 case "$BPP" in
26 8|24|32) ;;
27 *) BPP=16 ;;
28 esac
29 [ -n "$PORT" ] || PORT=5900
30 [ -n "$SERVER" ] || SERVER="192.168.0.10"
31 cat <<EOT
32 <table>
33 <tr>
34 <td>Autostart</td>
35 <td>
36 <input type="radio" name="START" $([ "$START" = "no" ] && echo "checked=checked ")value="no"> never
37 <input type="radio" name="START" $([ "$START" = "yes" ] && echo "checked=checked ")value="yes"> always
38 <input type="radio" name="START" $([ "$START" = "ask" ] && echo "checked=checked ")value="ask"> ask during boot
39 <input type="radio" name="START" $([ "$START" = "cmdline" ] && echo "checked=checked ")value="cmdline"> with kernel argument 'fbvnc=<i>server</i>:<i>port</i>'
40 </td>
41 </tr>
42 <tr>
43 <td>Bits per pixel</td>
44 <td>
45 <input type="radio" name="BPP" $([ "$BPP" = "8" ] && echo "checked=checked ")value="8"> 8
46 <input type="radio" name="BPP" $([ "$BPP" = "16" ] && echo "checked=checked ")value="16"> 16
47 <input type="radio" name="BPP" $([ "$BPP" = "32" ] && echo "checked=checked ")value="32"> 32
48 </td>
49 </tr>
50 <tr>
51 <td>Default server</td>
52 <td><input type="text" name="SERVER" value="$SERVER"></td>
53 </tr>
54 <tr>
55 <td>Default port</td>
56 <td><input type="text" name="PORT" value="$PORT"></td>
57 </tr>
58 </table>
59 EOT
60 }
62 config_note()
63 {
64 cat <<EOT
65 <script type="text/javascript">
66 function update_form()
67 {
68 var hide = true
69 for (var i = 0; i < document.forms.length; i++) {
70 for (var j = 0; j < document.forms[i].elements.length; j++) {
71 var obj = document.forms[i].elements[j]
72 if (obj.name == "START" && obj.defaultValue == "yes"
73 && obj.checked == true)
74 hide = false
75 }
76 }
77 for (var i = 0; i < document.forms.length; i++) {
78 for (var j = 0; j < document.forms[i].elements.length; j++) {
79 var obj = document.forms[i].elements[j]
80 switch (obj.name) {
81 case "SERVER" :
82 case "PORT" :
83 obj.disabled = hide; break;
84 }
85 }
86 }
87 }
88 update_form()
89 window.onchange = update_form
90 //-->
91 </script>
92 EOT
93 }
95 post_install()
96 {
97 case "$START" in
98 on) cat >> $1/etc/init.d/local.sh <<EOT
100 # From fbvnc-config
101 VNCSERVER="$SERVER"
102 VNCPORT="$PORT"
103 sed -i "s|tty1:.*|tty1::respawn:fbvnc -bpp $BPP $SERVER $PORT|" /etc/inittab
104 kill -1 1
105 EOT
106 ;;
107 ask) cat >> $1/etc/init.d/local.sh <<EOT
109 # From fbvnc-config
110 echo -n "VNC server to connect (example: 192.168.0.123 5900): "
111 read -t 30 SERVER
112 [ -n "\$SERVER" ] &&
113 sed -i "s|tty1:.*|tty1::respawn:fbvnc -bpp $BPP \$SERVER|" /etc/inittab
114 set -- \$SERVER 5900
115 VNCSERVER="\$1"
116 VNCPORT="\$2"
117 kill -1 1
118 EOT
119 ;;
120 cmdline) cat >> $1/etc/init.d/local.sh <<EOT
122 # From fbvnc-config
123 for i in \$(cat /proc/cmdline); do
124 case "\$i" in
125 fbvnc=*)
126 i=\${i#fbvnc=}
127 sed -i "s|tty1:.*|tty1::respawn:fbvnc -bpp $BPP \${i/:/ }|" /etc/inittab
128 set -- \${i/:/ } 5900
129 VNCSERVER="\$1"
130 VNCPORT="\$2"
131 kill -1 1
132 esac
133 done
134 EOT
135 ;;
136 esac
137 }