Annotation of /alx-src/branches/alxconf-060/functions/config_sessions.sh
Parent Directory | Revision Log
Revision 237 -
(hide annotations)
(download)
(as text)
Thu Mar 10 01:13:05 2005 UTC (19 years, 6 months ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_sessions.sh
File MIME type: application/x-sh
File size: 2880 byte(s)
Thu Mar 10 01:13:05 2005 UTC (19 years, 6 months ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/functions/config_sessions.sh
File MIME type: application/x-sh
File size: 2880 byte(s)
bad typo
1 | niro | 237 | # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_sessions.sh,v 1.2 2005-03-10 01:13:05 niro Exp $ |
2 | niro | 236 | # configures ica-sessions on the host via mysql db settings |
3 | |||
4 | get_sessions_settings() | ||
5 | { | ||
6 | local x i all count | ||
7 | |||
8 | #all arrays: | ||
9 | # -> session1 session2 ... sessionN | ||
10 | |||
11 | #get settings from database | ||
12 | all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
13 | "select session from cfg_sessions where serial='${ALX_SERIAL}'") | ||
14 | |||
15 | #split'em up and put in an array (only if $all not zero) | ||
16 | declare -i i=0 | ||
17 | if [ -n "${all}" ] | ||
18 | then | ||
19 | for x in ${all} | ||
20 | do | ||
21 | ALX_SESSIONS[${i}]=${x} | ||
22 | ((i++)) | ||
23 | done | ||
24 | count=${i} | ||
25 | else | ||
26 | count=0 | ||
27 | fi | ||
28 | |||
29 | export ALX_SESSIONS | ||
30 | } | ||
31 | |||
32 | config_sessions() | ||
33 | { | ||
34 | #first of all get the vars | ||
35 | get_sessions_settings | ||
36 | |||
37 | local count=${#ALX_SESSIONS[*]} | ||
38 | local icon | ||
39 | |||
40 | # DEBUG | ||
41 | declare -i i=0 | ||
42 | echo count=${count} | ||
43 | echo "Number of new sessions: ${count}" | ||
44 | for ((i=0; i < count; i++)) | ||
45 | do | ||
46 | echo "${i} - ${ALX_SESSIONS[${i}]}" | ||
47 | done | ||
48 | |||
49 | # now setup fluxbox for user station | ||
50 | |||
51 | # create a fresh fluxbox directory | ||
52 | [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox | ||
53 | install -d ${ALX_UNPRIV_HOME}/.fluxbox | ||
54 | |||
55 | # now generate fluxbox config files | ||
56 | |||
57 | # fluxbox main config | ||
58 | cat ${ALX_SKELETONS}/fluxbox/init \ | ||
59 | > ${ALX_UNPRIV_HOME}/.fluxbox/init | ||
60 | |||
61 | # fluxbox autostart | ||
62 | cat ${ALX_SKELETONS}/fluxbox/apps \ | ||
63 | > ${ALX_UNPRIV_HOME}/.fluxbox/apps | ||
64 | |||
65 | # fluxbox hotkeys | ||
66 | cat ${ALX_SKELETONS}/fluxbox/apps \ | ||
67 | > ${ALX_UNPRIV_HOME}/.fluxbox/keys | ||
68 | |||
69 | # fluxbox menu header | ||
70 | cat ${ALX_SKELETONS}/fluxbox/menu.header \ | ||
71 | > ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
72 | |||
73 | # fluxbox menu sessions | ||
74 | for (( i=0; i < count; i++ )) | ||
75 | do | ||
76 | echo "[exec] ($(basename ${ALX_SESSIONS[${i}]} .ica)) {wfica ${ALX_ICA_SESSIONS}/${i}}" \ | ||
77 | >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
78 | done | ||
79 | |||
80 | # fluxbox menu footer | ||
81 | cat ${ALX_SKELETONS}/fluxbox/menu.footer \ | ||
82 | >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
83 | |||
84 | |||
85 | # now we generate the desktop icons | ||
86 | cat ${ALX_SKELETONS}/idesk/ideskrc \ | ||
87 | niro | 237 | > ${ALX_UNPRIV_HOME}/.ideskrc |
88 | niro | 236 | |
89 | # whipe out old stuff and install a fresh directory | ||
90 | [ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop | ||
91 | install -d ${ALX_UNPRIV_HOME}/.idesktop | ||
92 | |||
93 | local name | ||
94 | for (( i=0; i < count; i++ )) | ||
95 | do | ||
96 | name="$(basename ${ALX_SESSIONS[${i}]} .ica)" | ||
97 | |||
98 | if [ -f ${ALX_SESSIONS_ICONS}/${name}.png ] | ||
99 | then | ||
100 | icon="${ALX_SESSIONS_ICONS}/${name}.png" | ||
101 | else | ||
102 | icon="${ALX_SESSIONS_ICONS}/default.png" | ||
103 | fi | ||
104 | |||
105 | echo "table Icon | ||
106 | Caption: ${name} | ||
107 | Command: wfica ${ALX_ICA_SESSIONS}/${i} | ||
108 | Icon: ${icon} | ||
109 | end" > ${ALX_UNPRIV_HOME}/.idesktop/${name}.lnk | ||
110 | done | ||
111 | |||
112 | # set correct permissions | ||
113 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} | ||
114 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox | ||
115 | chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox | ||
116 | chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop | ||
117 | chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc | ||
118 | |||
119 | |||
120 | # unset vars | ||
121 | unset ALX_SESSIONS | ||
122 | } |