Skip to content

Commit

Permalink
Update project and add new command
Browse files Browse the repository at this point in the history
- Add new command 'update' to get latest application update
- Update the conf file to reflect the version of the application
  • Loading branch information
hfally committed Oct 1, 2020
1 parent e1bb3a2 commit 6768fe8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bin/.eknorconf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
tld='staging'
version='1.0.1'
version='1.1.0'
ip='127.0.0.1'
32 changes: 26 additions & 6 deletions bin/eknor
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash -e

# Initialize sudo by getting the user to enter password once and not have to during any process.
sudo echo "Sudo initialized!" &>/dev/null

# Configuration file
source .eknorconf
script_location=$(dirname "${BASH_SOURCE[0]}")
Expand Down Expand Up @@ -105,6 +102,9 @@ link_folder () {

# Add TLS to project.
secure_link () {
# Initialize sudo by getting the user to enter password once and not have to during any process.
sudo echo "Sudo initialized!" &>/dev/null

# Verify that dependencies are available (openssl, mod_ssl).
absent_dependencies=()
dependencies=(openssl apache2 certutil)
Expand Down Expand Up @@ -235,7 +235,7 @@ _generate_tls () {
-reqexts SAN \
-extensions SAN \
-config <(cat /etc/ssl/openssl.cnf \
<(printf "[SAN]\nsubjectAltName=DNS:$domain,IP:127.0.0.1")) &> /dev/null
<(printf "[SAN]\nsubjectAltName=DNS:$domain,IP:$ip")) &> /dev/null

# Trust the certificate.
_trust_certificate $crt_path $domain &>/dev/null
Expand All @@ -259,12 +259,13 @@ info () {
printf "\n"

printf "${YELLOW}Available commands:$NC
${GREEN}tld${NC}\tDisplays/Sets domain tld
${GREEN}tld${NC}\t\tDisplays/Sets domain tld
${GREEN}help${NC}\t\tDisplays help for a given command [command optional]
${GREEN}link${NC}\t\tVirtualizes an existing project
${GREEN}secure${NC}\tAdds TLS to an already linked project
${GREEN}new${NC}\t\tCreates new project (name required)
${GREEN}park${NC}\t\tSets present directory as workspace/home for all projects\n"
${GREEN}park${NC}\t\tSets present directory as workspace/home for all projects
${GREEN}update${NC}\tUpdate eknor to the latest version\n"
exit 1
}

Expand Down Expand Up @@ -299,6 +300,19 @@ set_topic () {
$2\n"
}

# Pull new update for eknor
update () {
printf "Pulling update..."

printf "\n"

cd $script_location/../ && git pull origin master

printf "\n"

echo -e "${GREEN}Eknor updated!$NC"
}

# Display help for command
helps () {
[[ -n $1 ]] || info
Expand Down Expand Up @@ -326,6 +340,9 @@ helps () {
"secure")
helper="Add HTTPS to your linked project. This can only be done on an already linked project."
;;
"update")
helper="Update Eknor to the latest version."
;;
"help")
add="[<command>]"
argument="${GREEN}command${NC}\tThe command to explain"
Expand Down Expand Up @@ -373,6 +390,9 @@ case "$1" in
"install")
install
;;
"update")
update
;;
"help")
helps $2
exit 1
Expand Down

0 comments on commit 6768fe8

Please sign in to comment.