anchor.diff:  #    appendline "mysetting = myvalue" /etc/myconfig
   #
   function appendline {
  -  backupfile $2
  -  tmp=$2.tmp.`date +%s`
  -  cat $2 > ${tmp}
  -  echo $1 >> ${tmp}
  -  mv ${tmp} $2
  +  local line="$1" file="$2"
  +  backupfile "$file"
  +  tmp="$file.tmp.$(date +%s)"
  +  cp -p "$file" "$tmp"  # preserve perms
  +  cat "$file" > "$tmp"
  +  echo "$line" >> "$tmp"
  +  mv "$tmp" "$file"
   }
   
   # This function copies the necessary PEM files from Puppet to the PuppetDB
  
positive.code: #    commentline "^$mysetting.*" /etc/myconfig
  #
  function commentline {
    backupfile $2
    tmp=$2.tmp.`date +%s`
    sed "/$1/ s/^/# /" $2 > $tmp
    mv $tmp $2
  }
  
  # This function appends a line to a file
  #
  # $1 - line to append
  # $2 - file to operate on
  #
  # Example:
  
negative.code:       exit 1
      fi
    done
    if test -e "$ssl_dir"; then rm -r "$ssl_dir"; fi
    mkdir -m 700 "$ssl_dir"
    echo "Copying files: ${orig_ca_file}, ${orig_private_file} and ${orig_public_file} to ${ssl_dir}"
    cp -p "$orig_ca_file" "$ca_file"
    cp -p "$orig_private_file" "$private_file"
    cp -p "$orig_public_file" "$public_file"
  }
  
  ########
  