File: createVarsFile.sh

package info (click to toggle)
libowasp-esapi-java 2.4.0.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,000 kB
  • sloc: java: 35,401; xml: 1,630; sh: 373; makefile: 2
file content (47 lines) | stat: -rwxr-xr-x 1,678 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Purpose: Answer some questions and provide a new 'vars.<version>' from 'vars.template' to use for creating release notes.

prog="${0##*/}"

function iprompt    # prompt_message
{
    typeset ANS
    read -p "$@ (y|n): " ANS
    case "$ANS" in
    [Yy]|[Yy][Ee][Ss])  return 0    ;;
    *)  return 1    ;;
    esac
}

read -p "Enter release # for NEW ESAPI version you are doing release notes for: " VERSION
if [[ -f "vars.$VERSION" ]]
then
    iprompt "File 'vars.$VERSION' already exists. Continuing will overwrite it.  Continue?" || exit 1
fi


read -p "Enter release # for the PREVIOUS ESAPI version: " PREV_VERSION
read -p "Enter (planned) release date of NEW / current version you are preparing in YYYY-MM-DD format: " YYYY_MM_DD_RELEASE_DATE
read -p "Enter release date of PREVIOUS ESAPI version in YYYY-MM-DD format: " PREV_RELEASE_DATE

echo You entered:
echo =================================================
echo VERSION=$VERSION
echo PREV_VERSION=$PREV_VERSION
echo YYYY_MM_DD_RELEASE_DATE=$YYYY_MM_DD_RELEASE_DATE
echo PREV_RELEASE_DATE=$PREV_RELEASE_DATE
echo =================================================
echo

if iprompt "Are ALL your previous answers correct?"
then
    # Create the new    vars.${VERSION} file based on vars.template
    sed -e "s/^VERSION/VERSION=$VERSION/" \
        -e "s/^PREV_VERSION/PREV_VERSION=$PREV_VERSION/" \
        -e "s/^YYYY_MM_DD_RELEASE_DATE/YYYY_MM_DD_RELEASE_DATE=$YYYY_MM_DD_RELEASE_DATE/" \
        -e "s/^PREV_RELEASE_DATE/PREV_RELEASE_DATE=$PREV_RELEASE_DATE/" \
                vars.template > "vars.$VERSION"
else
    echo "$prog: Aborting. Rerun the script to correct your answers." >&2
    exit 1
fi