Magellan Linux

Diff of /branches/mage-next/src/sql/convert_databases.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 487 by niro, Tue May 1 11:46:52 2007 UTC revision 1642 by niro, Fri Jan 13 18:37:52 2012 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3  source /etc/mage.rc.global  : ${MAGERC="/etc/mage.rc"}
 source /etc/mage.rc  
   
   
 #### fixups ####  
 MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage  
 INSTALLDB=/var/db/mage  
 #################  
4    
5    source /etc/mage.rc.global
6    source ${MAGERC}
7  source ${MLIBDIR}/mage4.functions.sh  source ${MLIBDIR}/mage4.functions.sh
8    source ${MLIBDIR}/smage2.functions.sh
9  source ${MLIBDIR}/sql_functions.sh  source ${MLIBDIR}/sql_functions.sh
10    
11  die()  die()
# Line 118  convert_mage_db() Line 114  convert_mage_db()
114   # substitute r from pbuild   # substitute r from pbuild
115   pbuild="${pbuild/r/}"   pbuild="${pbuild/r/}"
116    
117   source ${magefile}   smagesource ${magefile}
118    
119   pcatid=$(sql "select id from categories where pcat='${pcat}'")   pcatid=$(sql "select id from categories where pcat='${pcat}'")
120   sql "insert into packages(   sql "insert into packages(
# Line 202  EOF Line 198  EOF
198    
199   mincludes="$(grep -r 'minclude ' ${magefile} | cut -d: -f2 | sed s:minclude\ ::)"   mincludes="$(grep -r 'minclude ' ${magefile} | cut -d: -f2 | sed s:minclude\ ::)"
200    
201     #
202   # install routines & includes   # install routines & includes
203     #
204     # needs special magic: the last line of typeset has no ';'
205     # but to eval the function we must append it
206     # so this sed deletes the last line of the typeset output
207     # and replaces it with an ;} and a newline between
208     #
209     # but we will not add this fun when no postinstall etc are given
210     # -> [[ -n $(typeset -f postinstall ]] &&
211     #
212     # also the character ' is a problem while importing to sql
213     # because we use ' as escape char. so we replace it with ''
214     #
215     # $([[ -n $(typeset -f postinstall) ]] && echo -e "$(typeset -f postinstall | sed s:\':\'\':g | sed '$d');\n}")
216     #
217   sql "insert into packages_routines(pkg_id,   sql "insert into packages_routines(pkg_id,
218   mincludes,   mincludes,
219   postinstall,   postinstall,
# Line 211  EOF Line 222  EOF
222   postremove)   postremove)
223   values('${pkgid}',   values('${pkgid}',
224   '${mincludes}',   '${mincludes}',
225   '$(typeset -f postinstall | sed s:\':\'\':g)',   '$([[ -n $(typeset -f postinstall) ]] && echo -e "$(typeset -f postinstall | sed s:\':\'\':g | sed '$d');\n}")',
226   '$(typeset -f preinstall | sed s:\':\'\':g)',   '$([[ -n $(typeset -f preinstall) ]] && echo -e "$(typeset -f preinstall | sed s:\':\'\':g | sed '$d');\n}")',
227   '$(typeset -f preremove | sed s:\':\'\':g)',   '$([[ -n $(typeset -f preremove) ]] && echo -e "$(typeset -f preremove | sed s:\':\'\':g | sed '$d');\n}")',
228   '$(typeset -f postremove | sed s:\':\'\':g)')"   '$([[ -n $(typeset -f postremove) ]] && echo -e "$(typeset -f postremove | sed s:\':\'\':g | sed '$d');\n}")')"
229    
230   unset PKGNAME   unset PKGNAME
231   unset DEPEND   unset DEPEND

Legend:
Removed from v.487  
changed lines
  Added in v.1642