source: lliurex-up/trunk/fuentes/scripts/common/cdd-version-fixer @ 2609

Last change on this file since 2609 was 2609, checked in by kbut, 4 years ago

refactoring

File size: 4.4 KB
Line 
1#!/bin/sh
2# Installing packages (doing the real dist-upgrade)
3
4# gettext domain
5TEXTDOMAIN="lliurex-up"
6export TEXTDOMAIN
7
8COMMON_LIBRARY="/usr/share/lliurex-up/common-upgrade-vars.sh"
9if [  -r $COMMON_LIBRARY  ] ; then 
10        . $COMMON_LIBRARY
11fi
12
13#gettext messages
14INFO_MESSAGE="$(gettext "Install required packages")"
15SERVER_ATENTION_MESSAGE="$(gettext "This seems a LliureX Server, caution. ")"
16SERVER_REMOVE_PACKAGES_MESSAGE="$(gettext "Removing some packages")"
17SERVER_INSTALL_PACKAGES_MESSAGE="$(gettext "Installed some packages")"
18
19# Methods
20
21
22
23_commonPreUpgradeActions()
24{
25        # Cache for APT clean
26        apt-get clean   
27}
28
29_commonPostUpgradeActions()
30{
31        echo " * [ LliureX Up ] : Nothing to do"
32}
33
34# Pre Upgrade Actions
35_serverPreUpgradeActions()
36{
37        echo "$SERVER_ATENTION_MESSAGE"
38}
39
40_musicaPreUpgradeActions()
41{
42        echo " * [ LliureX Up ] : Musica Upgrade"
43}
44
45_infantilPreUpgradeActions()
46{
47        echo " * [ LliureX Up ] : Infantil Upgrade"
48}
49
50_desktopPreUpgradeActions()
51{
52        echo " * [ LliureX Up ] : Desktop Upgrade"
53}
54
55_xDesktopPreUpgradeActions()
56{
57        echo " * [ LliureX Up ] : XDesktop Upgrade"
58}
59
60_biblioPreUpgradeActions()
61{
62        echo " * [ LliureX Up ] : Biblioteca Upgrade"
63}
64
65_clientPreUpgradeActions()
66{
67        echo " * [ LliureX Up ] : Client Upgrade"
68}
69
70_teachersPreUpgradeActions()
71{
72        echo " * [ LliureX Up ] : Teachers Upgrade"
73}
74
75_pimePreUpgradeActions()
76{
77        echo " * [ LliureX Up ] : Pime Upgrade"
78}
79# Post Upgrade Actions
80
81_serverCddVersionFixer()
82{
83        echo "$SERVER_ATENTION_MESSAGE"
84        # Install some packages.
85        echo "$SERVER_INSTALL_PACKAGES_MESSAGE"         
86        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_SERVER" 
87}
88
89_musicaCddVersionFixer()
90{
91        echo " * [ LliureX Up ] : * Musica Upgrade"
92        # Install some packages
93        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_MUSIC"
94}
95
96_infantilCddVersionFixer()
97{
98        echo " * [ LliureX Up ] : * Infantil Upgrade"
99        # Install some packages
100        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_INFANTIL"
101}
102
103_desktopCddVersionFixer()
104{
105        echo " * [ LliureX Up ] : * Desktop Upgrade"
106        # Install some packages
107        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_DESKTOP"
108}
109
110_eduDesktopCddVersionFixer()
111{
112        echo " * [ LliureX Up ] : * Edu Desktop Upgrade"
113        # Install some packages
114        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_EDUDESKTOP"
115}
116
117_xDesktopCddVersionFixer()
118{
119        echo " * [ LliureX Up ] : * Xdesktop Upgrade"
120        # Install some packages
121        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_XDESKTOP"
122}
123
124_biblioCddVersionFixer()
125{
126        echo " * [ LliureX Up ] : * Biblioteca Upgrade"
127        # Install some packages
128        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_BIBLIOTECA"
129}
130
131_clientCddVersionFixer()
132{
133        echo " * [ LliureX Up ] : * Client"
134        # Install some packages
135        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_CLIENT"
136}
137
138_teachersCddVersionFixer()
139{
140        echo " * [ LliureX Up ] : * Teachers Upgrade"
141        # Install some packages
142        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_TEACHERS"
143}
144
145_liteCddVersionFixer(){
146        echo " * [ LliureX Up ] : * Lite Upgrade"
147        # install some packages
148        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_LITE"
149}
150
151_gvaCddVersionFixer()
152{
153        echo " * [ LliureX Up ] : * GVA Upgrade"
154        # install some packages
155        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_GVA"
156}
157
158_pimeCddVersionFixer()
159{
160        echo " * [ LliureX Up ] : * Pime Upgrade"
161        # install some packages
162        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_PIME"
163}
164
165_info()
166{
167        echo "$INFO_MESSAGE"
168}
169
170_migrate()
171{
172        _discoverCddVersion
173
174        if [ $IS_SERVER -eq 0 ] ; then
175                _serverCddVersionFixer
176
177        elif [ $IS_CLIENT -eq 0 ] ; then
178                _clientCddVersionFixer
179               
180        elif [ $IS_GVA -eq 0 ] ; then
181                _gvaCddVersionFixer     
182
183        elif [ $IS_BIBLIO -eq 0 ] ; then
184                _biblioCddVersionFixer
185
186        elif [ $IS_INFANTIL -eq 0 ] ; then     
187                _infantilCddVersionFixer
188       
189        elif [ $IS_EDUDESKTOP -eq 0 ] ; then
190                _eduDesktopCddVersionFixer
191       
192        elif [ $IS_PIME -eq 0 ] ; then
193                _pimeCddVersionFixer
194
195        elif [ $IS_DESKTOP -eq 0 ] ; then
196                _desktopCddVersionFixer
197
198        elif [ $IS_XDESKTOP -eq 0 ] ; then
199                _xDesktopCddVersionFixer
200
201        elif [ $IS_MUSIC -eq 0 ] ; then
202                _musicaCddVersionFixer
203       
204        elif [ $IS_TEACHERS -eq 0 ] ; then
205                _teachersCddVersionFixer
206
207        elif [  $IS_LITE -eq 0 ] ; then
208                _liteCddVersionFixer
209
210
211        else 
212                echo " * [ LliureX Up ] : * Is almost a Desktop"
213                _desktopCddVersionFixer
214        fi
215       
216        _commonPostUpgradeActions
217
218}
219
220_usage()
221{       
222        echo "# Unknown argument"
223}
224
225_die()
226{
227        echo "Error: $1"
228        exit 1
229}
230
231ACTION="$1"
232case "$ACTION" in
233        migrate)
234                _migrate
235        ;;
236        info)
237                _info
238        ;;
239        *)
240                _usage
241        ;;
242esac
243
244exit 0
Note: See TracBrowser for help on using the repository browser.