-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Installs lsb_release package if it was not found (#38)
- Loading branch information
1 parent
05a9b57
commit e2c3407
Showing
3 changed files
with
62 additions
and
2 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,45 @@ | ||
#!/usr/bin/env bash | ||
|
||
find_package_manager() { | ||
local package_manager= | ||
for package_manager in 'apt-get' 'yum' | ||
do | ||
if vagrant ssh -- -n "which ${package_manager}" &>/dev/null | ||
then | ||
echo "${package_manager}" | ||
return 0 | ||
fi | ||
done | ||
|
||
return 1 | ||
} | ||
|
||
install_lsb_release_package() { | ||
local package_manager=$(find_package_manager) | ||
local known_package_names='lsb_release redhat-lsb' | ||
|
||
# is it already installed ? | ||
for package_name in ${known_package_names} | ||
do | ||
vagrant ssh -- -n "which lsb_release" &>/dev/null && return 0 | ||
done | ||
|
||
if [ -z "${package_manager}" ] | ||
then | ||
return 1 | ||
fi | ||
|
||
for package_name in ${known_package_names} | ||
do | ||
case "${package_manager}" in | ||
"apt-get") | ||
vagrant ssh -- -n "sudo apt-get install -y ${package_name}" &>/dev/null && return 0 | ||
;; | ||
"yum") | ||
vagrant ssh -- -n "sudo yum install -y ${package_name}" &>/dev/null && return 0 | ||
;; | ||
esac | ||
done | ||
|
||
return 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
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