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: fi
  
  # Fix SSL permissions
  chmod 600 ${ssl_dir}/*
  chmod 700 ${ssl_dir}
  chown -R ${user}:${group} ${ssl_dir}
  
  if [ -f "$jettyfile" ] ; then
    # Check settings are correct and fix or warn
  
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"
  }
  
  ########
  