This repository has been archived by the owner on Oct 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Implement unified interface to install scripts #11
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a66428b
Initial commit for hassbian-config script.
kxtcd950 06b16c1
Add documentation for hassbian-config.
kxtcd950 c99336a
Added comment as to why the homeassistant suite is not in the list of…
kxtcd950 58c0ddd
Attempt to commit all local changes (I'm not familiar with git, sorry).
kxtcd950 1c653b6
Added stanzas to all suite installers; updated install_homeassistant.…
kxtcd950 bdb93c0
Untab file - somehow tabs had crept in, not spaces.
kxtcd950 d16bbf8
Fixup tabs
kxtcd950 21dd164
Change package long info text to reflect reality.
kxtcd950 37a636e
Remove local testing variable.
kxtcd950 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,88 @@ | ||
#!/bin/bash | ||
|
||
SUITE_INSTALL_DIR=/home/pi/hassbian-scripts | ||
SUITE_INSTALL_DIR=/home/dave/Projects/hassbian/hassbian-scripts | ||
|
||
function usage { | ||
echo $0: usage: | ||
echo | ||
echo $0 \<command\> \<suite\> | ||
echo where \<command\> is one of: | ||
echo install - installs a software suite | ||
echo show - shows software suites available | ||
echo and \<suite\> is the name of a software component to operate on. | ||
echo | ||
} | ||
|
||
function show-suite-info { | ||
source $SUITE_INSTALL_DIR/install_$1.sh | ||
$1-show-long-info | ||
} | ||
|
||
function show-suites { | ||
echo List of suites available for installation: | ||
# inhibit the homeassistant suite from being displayed, to discourage its (re-)installation. | ||
suites=$(ls $SUITE_INSTALL_DIR/install_*.sh | grep -Po "install_\K(.*)\.sh$" | awk -F. '!/homeassistant/ {print $1}') | ||
|
||
for i in $suites | ||
do | ||
echo $i: $(show-suite-info $i) | ||
done | ||
} | ||
|
||
function show-suite-long-info { | ||
# Shows long info for the suite. | ||
source $SUITE_INSTALL_DIR/install_$1.sh | ||
$1-show-short-info | ||
$1-show-long-info | ||
$1-show-copyright-info | ||
} | ||
|
||
function install-suite { | ||
# Having got here, the installer script exists; source it, then run the installer function. | ||
source $SUITE_INSTALL_DIR/install_$1.sh | ||
$1-install-package | ||
} | ||
|
||
function verify-suite { | ||
# Check that the suite specified actually exists | ||
if [ ! -f "$SUITE_INSTALL_DIR/install_$1.sh" ] | ||
then | ||
echo "Cannot find suite $1." | ||
echo "Try running the show command to see all available suites" | ||
exit | ||
fi | ||
} | ||
|
||
if [ $# -lt 1 ] | ||
then | ||
usage | ||
exit | ||
fi | ||
COMMAND=$1 | ||
SUITE=$2 | ||
|
||
|
||
case $COMMAND in | ||
"show") | ||
if [ "$SUITE" != "" ] | ||
then | ||
verify-suite $SUITE | ||
show-suite-long-info $SUITE | ||
else | ||
show-suites | ||
fi | ||
;; | ||
"install") | ||
verify-suite $SUITE | ||
install-suite $SUITE | ||
exit | ||
;; | ||
"info") | ||
verify-suite $SUITE | ||
info-suite $SUITE | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac |
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 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There shouldn't need to be any change to this script since it's the one ran when we create the image. It's not run after the image is created so the tool shouldn't need to care about this script. Might move this script into the files folder but no change you need to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this too - it's a breaking change for first installation, which I'm not happy with. I'm sorta thinking that having it available isn't a bad idea, as it allows for reinstalls of homeassistant to happen from the hassbian-config script; otherwise users have to find out how to perform this one install themselves. I did inhibit it from being viewed as a "suite" though, because it shouldn't ordinarily be run...
With a little more effort, it may be possible to detect that install_homeassistant.sh is being run at first-run time, and make it work as it has previously. It's a case of changing the very last line of the script.
If you're interested, I could look into making this change; but I'm at work and so it won't be a speedily forthcoming one :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it's not as difficult as I first thought. I've just pushed a new change in so that the install_homeassistant.sh script when run standalone acts as if it were the old installer. Bonus: it still fits in the hassbian-config mechanism so it can be used from there too.
This also fixes the install_homeassistant.sh script's hashbang which somehow hadn't been edited to use bash, but /bin/sh - which precluded the whole lot working.