Changeset 59


Ignore:
Timestamp:
04/06/2006 20:41:27 (6 years ago)
Author:
ccowart
Message:

Importing not-world-readable files

Location:
confman
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • confman/confman

    r58 r59  
    1 #! /usr/local/bin/bash 
     1#! /bin/bash 
    22# 
    33# confman provides a command-line interface to Rescomp's server configuration  
     
    504504                local count 
    505505 
     506                # Let's see if we can read the file as ourself: 
     507                if [ ! -r $file ] ; then 
     508                        usefile=`mktemp -t confman` 
     509                        sudo cat $file > $usefile 
     510                else 
     511                        usefile="$file" 
     512                        cat $file > $usefile 
     513                fi 
     514 
    506515                # Put all non-alphanumerics into a file 
    507                 awk '{print $1}' $file | egrep -o "^[^-_A-Za-z0-9]" > $tmpfile 
    508                 for char in `cat $file | sort | uniq` ; do 
     516                awk '{print $1}' $usefile | egrep -o \ 
     517                        "^[^-_A-Za-z0-9]" > $tmpfile 
     518 
     519                for char in `cat $tmpfile | sort | uniq` ; do 
    509520                        count=`egrep -o "\\$char" $tmpfile | wc -l` 
    510521                        if [ $count -gt $biggestcount ] ; then 
  • confman/confmanlib.sh

    r57 r59  
    1 #! /usr/local/bin/bash 
     1#! /bin/bash 
     2# 
    23# This file provides shell libraries to our configuration management system. 
    34# It will be sourced by the relevant Rescomp scripts. 
    4  
     5#  
     6# Author: Chris Cowart <ccowart@rescomp.berkeley.edu> 
     7# Date: 30 March 2006 
     8# 
    59# $Id$ 
    610 
     
    120124                  mode=`conf_get_prop  ${myfile} mode` 
    121125                  comment=`conf_get_prop  ${myfile} comment` 
    122                   msg="This portion controlled under the ${layer} module." 
    123                   echo "${comment} $msg" >> $tmpfile 
    124126                  cat $livepart >> $tmpfile 
    125127                  sudo rm $livepart 
     
    209211  local myfile="${WORK_PATH}/${module}${file}" 
    210212  local warning="${comment} ${CONF_WARNING}" 
     213  local morewarn="${comment} Managed under ${module} module." 
    211214  local revision="${comment} \$Id\$" 
    212215  echo $file 
    213216 
    214217  if [ -z $usefile ] ; then 
    215           echo -e "${warning}\n${revision}\n" > $myfile 
    216   elif head -n 1 ${file%-${module}} | grep '^#!' >/dev/null ; then 
    217           awk "{ if (NR==2) print \"\\n${warning}\\n${revision}\\n\"\$0;  
    218                  else print \$0 }" ${file%-${module}} > $myfile 
     218          echo -e "${warning}\n${morewarn}\n${revision}\n" > $myfile 
     219  elif head -n 1 ${usefile} | grep '^#!' >/dev/null ; then 
     220          awk "{if (NR==2)  
     221                     print \"\\n${warning}\\n${morewarn}\\n${revision}\\n\"\$0; 
     222                else print \$0 }" ${usefile} > $myfile 
    219223  else 
    220           echo -e "${warning}\n${revision}\n" > $myfile 
    221           cat ${file%-${module}} >> $myfile 
     224          echo -e "${warning}\n${morewarn}\n${revision}\n" > $myfile 
     225          cat ${usefile} >> $myfile 
    222226  fi 
    223227 
Note: See TracChangeset for help on using the changeset viewer.