-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move configuration/*.sh files to .env and .env.dist
- Loading branch information
1 parent
d8f835c
commit 7645b75
Showing
8 changed files
with
62 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
#### | ||
# Configuration file | ||
# | ||
# VALUE_NAME=<default_value> # <available_value>, [<available_value>...] | ||
# 0,1: Handled as boolean values. 0 means off, 1 means on | ||
#### | ||
ASK_TO_DUMP_ISO=0 #0|1 | ||
ASK_TO_RUN_ISO=0 #0|1 | ||
ASK_TO_UPLOAD_ISO=0 #0|1 | ||
BE_VERBOSE=0 #0|1 | ||
BUILD_FILE_NAME="archlinux-archzfs-${KERNEL}" #<string> | ||
IS_DRY_RUN=0 #0|1 | ||
IS_FORCED=0 #0|1 | ||
KERNEL="linux" #linux|linux-lts | ||
PATH_TO_SSH_KEY_FILE="~/.ssh/example_key" # used for uploading iso | ||
REPO_INDEX="last" #week|month|yyyy/mm/dd | ||
SCP_HOST_PATH="[email protected]:/my/path/" # used for uploading iso | ||
USE_GIT_PACKAGE=0 #0|1 | ||
USE_DKMS=0 #0|1 | ||
USE_OTHER_REPO_INDEX=0 #0|1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.env | ||
build.sh.log | ||
configuration/*.sh | ||
dynamic_data/* | ||
last_build_date.txt | ||
last_build_date_lts.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,59 +56,6 @@ function _create_latest_build_date () | |
echo "${CREATION_DATE_TIME}" > "${LATEST_BUILD_DATE_FILE_PATH}" | ||
} | ||
|
||
#### | ||
# @param: <string: path_to_the_local_configuration_file | ||
#### | ||
function _create_local_configuration_file () | ||
{ | ||
#bo: variables | ||
local CURRENT_DATE | ||
local PATH_TO_THE_LOCAL_CONFIGURATION | ||
local PATH_TO_THE_LOCAL_CONFIGURATION_DIST | ||
|
||
CURRENT_DATE=$(date +'%y-%m-%d') | ||
PATH_TO_THE_LOCAL_CONFIGURATION="${1}" | ||
|
||
PATH_TO_THE_LOCAL_CONFIGURATION_DIST="${PATH_TO_THE_LOCAL_CONFIGURATION}.dist" | ||
#eo: variables | ||
|
||
#bo: check environment | ||
if [[ ! -f "${PATH_TO_THE_LOCAL_CONFIGURATION_DIST}" ]]; | ||
then | ||
echo ":: ERROR - File does not exist!" | ||
echo " File path >>${PATH_TO_THE_LOCAL_CONFIGURATION_DIST}<< is invalid." | ||
|
||
exit 30 | ||
fi | ||
|
||
echo ":: Local configration file is missing. I will create it but you need to answere some questions." | ||
|
||
cp "${PATH_TO_THE_LOCAL_CONFIGURATION_DIST}" "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
#eo: check environment | ||
|
||
#bo: user input ssh key | ||
echo " Please insert the path to the ssh key we want to use." | ||
#-e: enable readline. @see https://stackoverflow.com/questions/4819819/get-autocompletion-when-invoking-a-read-inside-a-bash-script | ||
read -e PATH_TO_SSH_KEY_FILE | ||
|
||
#eo: user input ssh key | ||
|
||
#bo: user input destination scp host path" | ||
echo " Please insert the destionation host path." | ||
echo " Example: [email protected]:/foo/bar" | ||
read SCP_HOST_PATH | ||
|
||
echo "#@since: ${CURRENT_DATE}" >> "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
echo "####" >> "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
echo "" >> "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
echo "#0 = off, 1 = on" >> "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
echo "local PATH_TO_SSH_KEY_FILE=\"${PATH_TO_SSH_KEY_FILE}\"" >> "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
echo "local SCP_HOST_PATH=\"${SCP_HOST_PATH}\"" >> "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
|
||
_echo_if_be_verbose " Created file >>${PATH_TO_THE_LOCAL_CONFIGURATION}<<." | ||
#eo: user input destination scp host path" | ||
} | ||
|
||
#### | ||
# @param <string: output> | ||
#### | ||
|
@@ -123,19 +70,31 @@ function _echo_if_be_verbose () | |
function _main () | ||
{ | ||
#bo: variables | ||
local PATH_TO_THE_DISTRIBUTION_ENVIRONMENT_FILE | ||
local PATH_TO_THE_ISO | ||
local PATH_TO_THIS_SCRIPT | ||
local PATH_TO_THE_ISO | ||
local PATH_TO_THE_ISO_SHA512 | ||
local PATH_TO_THE_LATEST_BUILD_DATE | ||
local PATH_TO_THE_LOCAL_CONFIGURATION | ||
|
||
local PATH_TO_THE_OPTIONAL_ENVIRONMENT_FILE | ||
|
||
PATH_TO_THIS_SCRIPT=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd) | ||
|
||
PATH_TO_THE_LOCAL_CONFIGURATION="${PATH_TO_THIS_SCRIPT}/configuration/upload_iso.sh" | ||
PATH_TO_THE_DISTRIBUTION_ENVIRONMENT_FILE="${PATH_TO_THIS_SCRIPT}/.env.dist" | ||
PATH_TO_THE_OPTIONAL_ENVIRONMENT_FILE="${PATH_TO_THIS_SCRIPT}/.env" | ||
#eo: variables | ||
|
||
#bo: load environment files | ||
set -a | ||
source "${PATH_TO_THE_DISTRIBUTION_ENVIRONMENT_FILE}" | ||
if [[ -f "${PATH_TO_THE_OPTIONAL_ENVIRONMENT_FILE}" ]]; | ||
then | ||
source "${PATH_TO_THE_OPTIONAL_ENVIRONMENT_FILE}" | ||
fi | ||
set +a | ||
#eo: load environment files | ||
|
||
#bo: user input | ||
#we are storing all arguments for the case if the script needs to be re-executed as root/system user | ||
local ALL_ARGUMENTS_TO_PASS | ||
|
@@ -209,17 +168,6 @@ function _main () | |
fi | ||
#eo: output used flags | ||
|
||
#bo: load or create local configuration | ||
if [[ ! -f ${PATH_TO_THE_LOCAL_CONFIGURATION} ]]; | ||
then | ||
_echo_if_be_verbose " No file >>${PATH_TO_THE_LOCAL_CONFIGURATION}<< found." | ||
_create_local_configuration_file "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
fi | ||
|
||
_echo_if_be_verbose " Sourcing file >>${PATH_TO_THE_LOCAL_CONFIGURATION}<< found." | ||
source "${PATH_TO_THE_LOCAL_CONFIGURATION}" | ||
#eo: load or create local configuration | ||
|
||
#bo: environment check | ||
if [[ ! -f "${PATH_TO_THE_ISO}" ]]; | ||
then | ||
|
@@ -258,4 +206,4 @@ function _main () | |
#eo: upload | ||
} | ||
|
||
_main ${@} | ||
_main "${@}" |