Magellan Linux

Diff of /branches/mage-next/src/etc-update.in

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

trunk/mage/usr/lib/mage/etc-update revision 57 by niro, Tue Feb 15 00:37:07 2005 UTC branches/mage-next/src/etc-update.in revision 2600 by niro, Tue Mar 4 10:59:45 2014 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # Copyright 2002 Gentoo Technologies, Inc.  # $Id$
3  # Distributed under the terms of the GNU Public License v2  #
4    # Copyright 1999-2004 Gentoo Foundation
5    # Distributed under the terms of the GNU General Public License v2
6    # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/etc-update,v 1.7 2005-10-26 08:11:30 niro Exp $
7    
8  # Author Brandon Low <lostlogic@gentoo.org>  # Author Brandon Low <lostlogic@gentoo.org>
9  #  #
10  # Previous version (from which I've borrowed a few bits) by:  # Previous version (from which I've borrowed a few bits) by:
# Line 8  Line 12 
12  # Leo Lipelis <aeoo@gentoo.org>  # Leo Lipelis <aeoo@gentoo.org>
13  # Karl Trygve Kalleberg <karltk@gentoo.org>  # Karl Trygve Kalleberg <karltk@gentoo.org>
14  #  #
 # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/etc-update,v 1.5 2005-02-15 00:36:58 niro Exp $  
15    
16  # Modified by Niels Rogalla <niro@magellan-linux.de> to use this with Magellan-Linux  # Modified by Niels Rogalla <niro@magellan-linux.de> to use this with Magellan-Linux
17  # version: 0.3.6-r12  # version: 0.4.0-r8
   
 export PORTAGE_CALLER="etc-update"  
18    
19  function get_config() {  function get_config() {
20   item=$1   item=$1
# Line 22  function get_config() { Line 23  function get_config() {
23   # item. If there's more than one of the same configuration item,   # item. If there's more than one of the same configuration item,
24   # then allow the last setting to take precedence.   # then allow the last setting to take precedence.
25   cut -d'#' -f1-1 /etc/etc-update.conf | \   cut -d'#' -f1-1 /etc/etc-update.conf | \
26   sed -ne "s/^\ *$item\ *=\ *\"\(.*\)\"/\1/p" |sed -e '$p;d'   sed -ne "s/^ *$item *= *\([\"']\{0,1\}\)\(.*\)\1/\2/p" |sed -e '$p;d'
27  }  }
28    
29  function scan() {  function scan() {
# Line 35  function scan() { Line 36  function scan() {
36    
37   for path in ${CONFIG_PROTECT}; do if [ -d ${path} ]; then   for path in ${CONFIG_PROTECT}; do if [ -d ${path} ]; then
38   ofile=""   ofile=""
39   for file in `find ${path} -iname "._cfg????_*" |   for file in `find ${path}/ -iname "._cfg????_*" |
40     sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" |     sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\2\%\3:" |
41     sort -t'%' -k3 -k2 | cut -f1 -d'%'`; do     sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'`; do
42   rpath=`echo "${file}" | sed -e "s:/[^/]*$::"`   rpath=`echo "${file/\/\///}" | sed -e "s:/[^/]*$::"`
43   rfile=`echo "${file}" | sed -e "s:^.*/::"`   rfile=`echo "${file/\/\///}" | sed -e "s:^.*/::"`
44   for mpath in ${CONFIG_PROTECT_MASK}; do   for mpath in ${CONFIG_PROTECT_MASK}; do
45   if [[ "${rpath}" == "${mpath}"* ]]; then   if [[ "${rpath}" == "${mpath}"* ]]; then
46   mv ${rpath}/${rfile} ${rpath}/${rfile:10}   mv ${rpath}/${rfile} ${rpath}/${rfile:10}
# Line 121  configuration file is followed by a list Line 122  configuration file is followed by a list
122   if (( ${mode} == 0 )); then   if (( ${mode} == 0 )); then
123   cat ${TMP}/menuitems   cat ${TMP}/menuitems
124   echo    "Please select a file to edit by entering the corresponding number."   echo    "Please select a file to edit by entering the corresponding number."
125     echo    "              (don't use -3 or -5 if you're unsure what to do)"
126   echo    "              (-1 to exit) (-3 to auto merge all remaining files)"   echo    "              (-1 to exit) (-3 to auto merge all remaining files)"
127   echo -n "                           (-5 to auto-merge AND not use 'mv -i'): "   echo -n "                           (-5 to auto-merge AND not use 'mv -i'): "
128   read input   read input
# Line 189  function do_file() { Line 191  function do_file() {
191   if (( ${my_input} == 0 )); then   if (( ${my_input} == 0 )); then
192   my_input=1   my_input=1
193   elif (( ${my_input} == -1 )); then   elif (( ${my_input} == -1 )); then
194     input=0
195   return   return
196   elif (( ${my_input} == ${fcount} )); then   elif (( ${my_input} == ${fcount} )); then
197   break   break
# Line 259  Please select from the menu above (-1 to Line 262  Please select from the menu above (-1 to
262   case ${my_input} in   case ${my_input} in
263   1) echo "Replacing ${ofile} with ${file}"   1) echo "Replacing ${ofile} with ${file}"
264     mv ${mv_opts} ${file} ${ofile}     mv ${mv_opts} ${file} ${ofile}
265       my_input=-1
266     continue     continue
267     ;;     ;;
268   2) echo "Deleting ${file}"   2) echo "Deleting ${file}"
# Line 350  scriptname=`basename $0` Line 354  scriptname=`basename $0`
354    
355  trap die term  trap die term
356    
357  TMP=/tmp/$$  TMP="/tmp/$$"
358  rm -rf ${TMP} 2> /dev/null  rm -rf ${TMP} 2> /dev/null
359  mkdir ${TMP} || die "failed mkdir command!" 1  mkdir ${TMP} || die "failed mkdir command!" 1
360    
361  # I need the CONFIG_PROTECT value  # I need the CONFIG_PROTECT value
362  #CONFIG_PROTECT=$(/usr/lib/portage/bin/portageq config_protect)  #CONFIG_PROTECT=$(/usr/lib/portage/bin/portageq config_protect)
363  #CONFIG_PROTECT_MASK=$(/usr/lib/portage/bin/portageq config_protect_mask)  #CONFIG_PROTECT_MASK=$(/usr/lib/portage/bin/portageq config_protect_mask)
 #source /etc/CONFIG_PROTECT  
364  source /etc/profile  source /etc/profile
365    
366  # load etc-config's configuration  # load etc-config's configuration
# Line 380  if (( ${mode} == 0 )); then Line 383  if (( ${mode} == 0 )); then
383   PAR=")"   PAR=")"
384  else  else
385   PAR=""   PAR=""
  rm_opts=""  
  mv_opts=""  
  cp_opts=""  
  pager=""P  
386  fi  fi
387    
388  declare -i count=0  declare -i count=0

Legend:
Removed from v.57  
changed lines
  Added in v.2600