source: lliurex-jclic-user-library/trunk/fuentes/lliurex-jclic-user-library.install/usr/bin/lliurex-jclic-user-library @ 5462

Last change on this file since 5462 was 5462, checked in by hectorgh, 3 years ago

fixing library location

File size: 3.3 KB
Line 
1#!/bin/bash
2
3share_locale=$(xdg_translator $LANG Share)
4
5lib_path="$HOME/$share_locale/jclic-aula/"
6
7if [ ! -e "$lib_path" ];then
8
9        exit 0
10
11fi
12
13libs=$(for x in $(find "$lib_path" -maxdepth 2 -name library.jclic -o -name jclic.jclic);do if [ "$(cat $x|grep menuElement|wc -l)" -gt "9" ]; then echo $x; fi; done;)
14
15L_RATOLI=''
16L_MESTRE=''
17L_MURCIA=''
18
19for x in $libs; do 
20    if [ -n "$(echo $x|egrep -i -o 'ratoli'|uniq)" ];then
21        L_RATOLI='<library name="Activitats JClic Infantil i Primària 29/07/2012" path="$lib_path/ratoli/library.jclic" />'
22    fi
23    if [ -n "$(echo $x|egrep -i -o 'elteumestre'|uniq)" ];then
24        L_MESTRE='<library name="elteumestre JClic Infantil i Primària" path="$lib_path/elteumestre_JClic_Infantil_Primaria_13.7/jclic.jclic" />'
25    fi
26    if [ -n "$(echo $x|egrep -i -o 'murcia'|uniq)" ];then
27        L_MURCIA='<library name="Biblioteca CPR MURCIA II 08/09" path="$lib_path/Murcia/library.jclic" />'
28    fi
29done;
30
31if [ -z "$L_RATOLI" -a -z "$L_MESTRE" -a -z "$L_MURCIA" ]; then
32    exit 0
33fi
34
35# Creacion plantillas de ficheros
36IFS=''
37edu_xtec_properties='#Tue Nov 08 13:04:30 CET 2016
38JClic=/home/__alumno__/JClic
39language=es'
40
41
42jclic_cfg='<?xml version="1.0" encoding="UTF-8"?>
43<JClicSettings>
44 <libraryManager autoRun="true">
45 __lib1__
46 __lib2__
47 __lib3__
48 </libraryManager>
49 <language id="es" />
50 <paths>
51  <path id="root" path="/home/__alumno__/JClic/projects" />
52 </paths>
53 <reporter enabled="false" class="TCPReporter" params="path=server:9000" />
54 <sound enabled="true" system="true" mediaSystem="default" />
55 <lookAndFeel id="default" />
56 <browser id="" />
57 <skin id="@default.xml" />
58 <recentFiles />
59</JClicSettings>'
60
61library_jclic='<?xml version="1.0" encoding="UTF-8"?>
62<JClicProject name="Sin_nombre" version="0.1.3" type="library">
63 <settings>
64  <title>Biblioteca principal</title>
65  <revision description="created" date="11/8/16" />
66  <descriptors />
67 </settings>
68 <sequence>
69  <item id="main" name="main">
70   <jump action="STOP" id="forward" />
71   <jump action="RETURN" id="back" />
72  </item>
73 </sequence>
74 <activities>
75  <activity class="@panels.Menu" name="main">
76   <description>
77    <p>Menú principal</p>
78   </description>
79   <messages>
80    <cell type="initial">
81     <style />
82     <p>Menú principal</p>
83    </cell>
84   </messages>
85   <settings margin="8" report="false">
86    <container bgColor="0xC0C0C0">
87     <counters time="false" actions="false" score="false" />
88    </container>
89    <window bgColor="0xC0C0C0" border="true" />
90   </settings>
91  </activity>
92 </activities>
93 <mediaBag />
94</JClicProject>'
95
96local_path="/home/$USER/"
97moving_path="/home/$USER/Documents/.moving_profiles"
98jclic_path="JClic/projects"
99
100properties_file=$(echo $edu_xtec_properties|sed -e "s%__alumno__%$USER%g")
101library_file=$library_jclic 
102cfg_file=$(echo $jclic_cfg|sed -e "s%__lib1__%$L_RATOLI%g" -e "s%__lib2__%$L_MESTRE%g" -e "s%__lib3__%$L_MURCIA%g" -e "s%__alumno__%$USER%g" -e "/^\s*$/d")
103
104mkdir -p $moving_path/$jclic_path
105echo $properties_file > $moving_path/.edu.xtec.properties
106echo $library_file > $moving_path/$jclic_path/library.jclic
107echo $cfg_file > $moving_path/JClic/jclic.cfg
108chown $USER:students $moving_path/.edu.xtec.properties
109chown -R $USER:students $moving_path/JClic
110
111mkdir -p $local_path/$jclic_path
112cp $moving_path/.edu.xtec.properties $local_path
113cp -R $moving_path/JClic $local_path
114
115exit 0
Note: See TracBrowser for help on using the repository browser.