From ae9adf2685bacafbb15ad365b9837cd5ef56bb22 Mon Sep 17 00:00:00 2001 From: Lucas Werkmeister Date: Mon, 11 Apr 2016 20:31:43 +0200 Subject: [PATCH] Rename shell scripts The usual convention is have no file name extension for executable scripts, and to name library scripts according to their shell (here: .bash). The rationale for the first part is that users do not need to konw whether a program is a shell script or not, and this allows one to rewrite the program in a different language (interpreted or compiled) without having to update anything that refers to the program name (documentation, crontab, etc.). In this case, the file name extensions were also misleading, since the scripts have a Bash shebang and use Bash features. If a user, based on the file name extension, had tried to run a script as `sh all.sh`, it would not have worked. Citation: Google Shell Style Guide, https://google.github.io/styleguide/shell.xml#File_Extensions --- README.md | 20 ++++++++--------- all.sh => all | 22 +++++++++---------- clear.sh => clear | 0 collectCRLs.sh => collectCRLs | 4 ++-- collectGigiConfig.sh => collectGigiConfig | 2 +- collectOffline.sh => collectOffline | 0 collectSignerConfig.sh => collectSignerConfig | 2 +- commonFunctions => commonFunctions.bash | 2 +- generateCRLs.sh => generateCRLs | 4 ++-- generateHtdocs.sh => generateHtdocs | 2 +- generateInfra.sh => generateInfra | 4 ++-- generateKeys.sh => generateKeys | 4 ++-- generateTime.sh => generateTime | 4 ++-- structure => structure.bash | 0 summary.sh => summary | 4 ++-- unpackOffline.sh => unpackOffline | 0 verify.sh => verify | 2 +- 17 files changed, 38 insertions(+), 38 deletions(-) rename all.sh => all (60%) rename clear.sh => clear (100%) rename collectCRLs.sh => collectCRLs (97%) rename collectGigiConfig.sh => collectGigiConfig (97%) rename collectOffline.sh => collectOffline (100%) rename collectSignerConfig.sh => collectSignerConfig (98%) rename commonFunctions => commonFunctions.bash (98%) rename generateCRLs.sh => generateCRLs (97%) rename generateHtdocs.sh => generateHtdocs (96%) rename generateInfra.sh => generateInfra (98%) rename generateKeys.sh => generateKeys (97%) rename generateTime.sh => generateTime (97%) rename structure => structure.bash (100%) rename summary.sh => summary (93%) rename unpackOffline.sh => unpackOffline (100%) rename verify.sh => verify (99%) diff --git a/README.md b/README.md index 75a13eb..fdbfc2b 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,23 @@ This is the a project that contains scripts to generate CAcerts new ( after 2015 ) root structure. -You can run the whole generation process for 2015 by invoking `./all.sh root 2015`. +You can run the whole generation process for 2015 by invoking `./all root 2015`. ## Overview of Generating Shell Scripts -The shellscripts that can be invoked (in order of `all.sh`) are: +The shellscripts that can be invoked (in order of `all`) are: -* `clear.sh` remove all previously generated keys -* `generateKeys.sh` generate the root certificate and structure certificates (levels 0 and 1) -* `generateTime.sh 2015` generate the sub-cas for the year 2015 -* `generateInfra.sh 2015` generate the CAcert Infrastructure keys (gigi ssl, gigi smime, signer communication, ...) -* `verify.sh 2015` verify all keys for the year 2015 -* (optional) `generateSignerConfig.sh 2015` generate config to be deployed on cassiopeia +* `clear` remove all previously generated keys +* `generateKeys` generate the root certificate and structure certificates (levels 0 and 1) +* `generateTime 2015` generate the sub-cas for the year 2015 +* `generateInfra 2015` generate the CAcert Infrastructure keys (gigi ssl, gigi smime, signer communication, ...) +* `verify 2015` verify all keys for the year 2015 +* (optional) `generateSignerConfig 2015` generate config to be deployed on cassiopeia all these scripts depend on 2 'library-scripts': -* `commonFunctions` functions used all over those scripts -* `structure` definitions of what cas and keys exist +* `commonFunctions.bash` functions used all over those scripts +* `structure.bash` definitions of what cas and keys exist ## Other Files and Folders diff --git a/all.sh b/all similarity index 60% rename from all.sh rename to all index d879829..df13337 100755 --- a/all.sh +++ b/all @@ -6,28 +6,28 @@ date for arg in "$@"; do if [[ "$arg" == "root" ]]; then echo "========== Generating Root =======" - ./clear.sh - ./generateKeys.sh + ./clear + ./generateKeys else echo "========== Generating Year $arg =======" - ./generateTime.sh "$arg" + ./generateTime "$arg" echo "========== Generating Infra for Year $arg =======" - ./generateInfra.sh "$arg" + ./generateInfra "$arg" echo "========== Generating CRLs for Year $arg =======" - ./generateCRLs.sh "$arg" + ./generateCRLs "$arg" echo "========== Verifying Year $arg =======" - ./verify.sh "$arg" + ./verify "$arg" echo "========== Collection things =======" - ./collectCRLs.sh "$arg" - ./collectGigiConfig.sh "$arg" - ./collectOffline.sh "$arg" - ./collectSignerConfig.sh "$arg" + ./collectCRLs "$arg" + ./collectGigiConfig "$arg" + ./collectOffline "$arg" + ./collectSignerConfig "$arg" - ./summary.sh "$arg" + ./summary "$arg" fi done diff --git a/clear.sh b/clear similarity index 100% rename from clear.sh rename to clear diff --git a/collectCRLs.sh b/collectCRLs similarity index 97% rename from collectCRLs.sh rename to collectCRLs index b123ca3..d5c1d49 100755 --- a/collectCRLs.sh +++ b/collectCRLs @@ -5,8 +5,8 @@ set -e [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 -. structure -. commonFunctions +. structure.bash +. commonFunctions.bash cd generated fetchCRLS(){ #year, cyear month timeIdx diff --git a/collectGigiConfig.sh b/collectGigiConfig similarity index 97% rename from collectGigiConfig.sh rename to collectGigiConfig index ee8b4f3..2e4092e 100755 --- a/collectGigiConfig.sh +++ b/collectGigiConfig @@ -4,7 +4,7 @@ set -e [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 -. structure +. structure.bash cd generated mkdir -p gigi-config/config/ca diff --git a/collectOffline.sh b/collectOffline similarity index 100% rename from collectOffline.sh rename to collectOffline diff --git a/collectSignerConfig.sh b/collectSignerConfig similarity index 98% rename from collectSignerConfig.sh rename to collectSignerConfig index d7c3aa6..84ddfd9 100755 --- a/collectSignerConfig.sh +++ b/collectSignerConfig @@ -4,7 +4,7 @@ set -e [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 -. structure +. structure.bash cd generated installCommKeys() { # peer (server,client) diff --git a/commonFunctions b/commonFunctions.bash similarity index 98% rename from commonFunctions rename to commonFunctions.bash index f46505b..1c1ffb1 100644 --- a/commonFunctions +++ b/commonFunctions.bash @@ -1,5 +1,5 @@ #!/bin/bash -. structure +. structure.bash genKey(){ #subj, internalName openssl genrsa -out $2.key ${KEYSIZE} diff --git a/generateCRLs.sh b/generateCRLs similarity index 97% rename from generateCRLs.sh rename to generateCRLs index 9e42081..0b2c14a 100755 --- a/generateCRLs.sh +++ b/generateCRLs @@ -5,8 +5,8 @@ set -e [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 -. structure -. commonFunctions +. structure.bash +. commonFunctions.bash cd generated generateCRL() { # name, year, month diff --git a/generateHtdocs.sh b/generateHtdocs similarity index 96% rename from generateHtdocs.sh rename to generateHtdocs index 386a308..66d1a0a 100755 --- a/generateHtdocs.sh +++ b/generateHtdocs @@ -1,6 +1,6 @@ #!/bin/bash -. structure +. structure.bash [[ "$1" == "" ]] && echo "Usage: $0 " && exit 1 year=$1 diff --git a/generateInfra.sh b/generateInfra similarity index 98% rename from generateInfra.sh rename to generateInfra index 6da9344..4bee84a 100755 --- a/generateInfra.sh +++ b/generateInfra @@ -5,8 +5,8 @@ set -e [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 -. structure -. commonFunctions +. structure.bash +. commonFunctions.bash cd generated diff --git a/generateKeys.sh b/generateKeys similarity index 97% rename from generateKeys.sh rename to generateKeys index 698542f..23429cb 100755 --- a/generateKeys.sh +++ b/generateKeys @@ -2,8 +2,8 @@ # this script generates a set of sample keys set -e -. structure -. commonFunctions +. structure.bash +. commonFunctions.bash mkdir -p generated cd generated diff --git a/generateTime.sh b/generateTime similarity index 97% rename from generateTime.sh rename to generateTime index 9e1dec5..5cabcbc 100755 --- a/generateTime.sh +++ b/generateTime @@ -1,7 +1,7 @@ #!/bin/bash -. structure -. commonFunctions +. structure.bash +. commonFunctions.bash [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 diff --git a/structure b/structure.bash similarity index 100% rename from structure rename to structure.bash diff --git a/summary.sh b/summary similarity index 93% rename from summary.sh rename to summary index 46ce2fb..0b4498a 100755 --- a/summary.sh +++ b/summary @@ -5,8 +5,8 @@ set -e [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 -. structure -. commonFunctions +. structure.bash +. commonFunctions.bash cd generated diff --git a/unpackOffline.sh b/unpackOffline similarity index 100% rename from unpackOffline.sh rename to unpackOffline diff --git a/verify.sh b/verify similarity index 99% rename from verify.sh rename to verify index 25efbdd..4239718 100755 --- a/verify.sh +++ b/verify @@ -3,7 +3,7 @@ set -e [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 -. structure +. structure.bash cd generated verify(){ # crt, [untrusted], additional -- 2.39.2