source: lliurex-up/trunk/fuentes/scripts/install-packages @ 2514

Last change on this file since 2514 was 2514, checked in by jrpelegrina, 4 years ago

WIP in checked packages to install

File size: 4.1 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")"
18APACHE_CRT_FILE="/etc/lliurex-secrets/certs/apache/apache.crt"
19APACHE_CRT_FILE_NCFG="/usr/share/ca-certificates/lliurex-certs/ncfg-certs/apache.crt"
20APACHE_CRT_FILE_NCFG_VAR="/var/lib/llxcfg-ncfg-certs/certificates/ncfg-certs/apache.crt"
21
22# Methods
23
24_commonPreUpgradeActions()
25{
26
27        for package in lliurex-live-ubiquity ubiquity ubiquity-casper ubiquity-frontend-gtk ubiquity-ubuntu-artwork casper-customize-mod-autologin casper-customize-mod-nsswitch; do
28            _test_and_remove_package ${package}
29        done
30
31}
32
33_musicaPreUpgradeActions()
34{
35        echo " * [ LliureX Up ] : Musica Upgrade"
36}
37
38_infantilPreUpgradeActions()
39{
40        echo " * [ LliureX Up ] : Infantil Upgrade"
41}
42
43_desktopPreUpgradeActions()
44{
45        echo " * [ LliureX Up ] : Desktop Upgrade"
46}
47
48_biblioPreUpgradeActions()
49{
50        echo " * [ LliureX Up ] : Biblioteca Upgrade"
51        _cleanhome
52}
53
54_clientPreUpgradeActions()
55{
56        echo " * [ LliureX Up ] : Client Upgrade"
57        _cleanhome
58}
59
60_teachersPreUpgradeActions()
61{
62        echo " * [ LliureX Up ] : Teachers Upgrade"
63}
64
65_pimePreUpgradeActions()
66{
67        echo " * [ LliureX Up ] : Pime Upgrade"
68}
69
70# Post Upgrade Actions
71
72_serverPostUpgradeActions()
73{
74        echo "$SERVER_ATENTION_MESSAGE"
75        # Install some packages.
76        echo "$SERVER_INSTALL_PACKAGES_MESSAGE"         
77        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_SERVER"
78        for package in modemmanager; do
79            _test_and_remove_package ${package}
80        done
81       
82}
83
84_musicaPostUpgradeActions()
85{
86        echo " * [ LliureX Up ] : Musica Upgrade"
87        # Install some packages
88        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_MUSIC"
89}
90
91_infantilPostUpgradeActions()
92{
93        echo " * [ LliureX Up ] : Infantil Upgrade"
94        # Install some packages
95        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_INFANTIL"
96}
97
98_desktopPostUpgradeActions()
99{
100        echo " * [ LliureX Up ] : Desktop Upgrade"
101        # Install some packages
102        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_DESKTOP"
103}
104
105_biblioPostUpgradeActions()
106{
107        echo " * [ LliureX Up ] : Biblioteca Upgrade"
108        # Install some packages
109        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_BIBLIOTECA"
110}
111
112_clientPostUpgradeActions()
113{
114        echo " * [ LliureX Up ] : Client"
115        # Install some packages
116        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_CLIENT"
117        for package in modemmanager lliurex-initramfs-tools-nsswitch ; do
118            _test_and_remove_package ${package}
119        done
120}
121
122_teachersPostUpgradeActions()
123{
124        echo " * [ LliureX Up ] : Teachers Upgrade"
125        # Install some packages
126        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_TEACHERS"
127}
128
129_pimePostUpgradeActions()
130{
131        echo " * [ LliureX Up ] : Pime Upgrade"
132        # Install some packages
133        apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_PIME"
134}
135
136_info()
137{
138        echo "$INFO_MESSAGE"
139}
140
141_migrate()
142{
143       
144        _discoverCddVersion
145        _commonPreUpgradeActions
146       
147        apt-get dist-upgrade -y --force-yes
148        apt-get -f install
149
150        if [ $IS_SERVER -eq 0 ] ; then
151                _serverPostUpgradeActions       
152        fi
153
154        if [ $IS_CLIENT -eq 0 ] ; then
155                _clientPostUpgradeActions
156        fi
157        update-grub
158}
159
160_usage()
161{
162        echo " * [ LliureX Up ] : # Unknown argument"
163
164}
165
166_die()
167{
168        echo " * [ LliureX Up ] : Error: $1"
169        exit 1
170}
171
172_partial()
173{
174       
175        _discoverCddVersion
176        _commonPreUpgradeActions
177
178        packages_list="/tmp/packages_checked"
179
180        if [ -s $packages_list ]; then
181                apt-get --force-yes install  $(cat $packages_list);     
182                apt-get -f install
183        else
184                 echo "* [ Lliurex Up ] : File packages_checked don't exist or is empty"
185               
186        fi                     
187       
188
189        if [ $IS_SERVER -eq 0 ] ; then
190                _serverPostUpgradeActions       
191        fi
192
193        if [ $IS_CLIENT -eq 0 ] ; then
194                _clientPostUpgradeActions
195        fi
196
197        update-grub
198
199}
200
201ACTION="$1"
202case "$ACTION" in
203        migrate)
204                _migrate
205        ;;
206        info)
207                _info
208        ;;
209        partial)
210                _partial
211        ;;     
212        *)
213                _usage
214        ;;
215esac
216
217exit 0
Note: See TracBrowser for help on using the repository browser.