mirror of
https://github.com/fsquillace/junest.git
synced 2026-07-19 01:17:04 +00:00
Fix issues on juju home directory
This commit is contained in:
parent
fd3b603ff9
commit
b85f054886
2 changed files with 17 additions and 18 deletions
24
bin/juju
24
bin/juju
|
|
@ -81,31 +81,33 @@ while true ; do
|
|||
esac
|
||||
done
|
||||
|
||||
$OPT_HELP && usage && exit
|
||||
$OPT_VERSION && version && exit
|
||||
|
||||
ARGS=()
|
||||
for arg do
|
||||
ARGS+=($arg)
|
||||
done
|
||||
|
||||
################ DEFINE ACTION ########################
|
||||
|
||||
$OPT_HELP && usage && exit
|
||||
$OPT_VERSION && version && exit
|
||||
|
||||
if $OPT_SETUP_FROM_FILE; then
|
||||
setup_from_file_juju ${ARGS[@]}
|
||||
exit
|
||||
setup_from_file_juju ${ARGS[@]}
|
||||
exit
|
||||
elif $OPT_BUILD_IMAGE; then
|
||||
build_image_juju
|
||||
build_image_juju
|
||||
exit
|
||||
elif $OPT_DELETE; then
|
||||
delete_juju
|
||||
exit
|
||||
fi
|
||||
|
||||
[ ! "$(ls -A $JUJU_HOME)" ] && ! $OPT_DELETE && setup_juju
|
||||
setup_juju
|
||||
|
||||
if $OPT_FAKEROOT; then
|
||||
run_juju_as_fakeroot
|
||||
run_juju_as_fakeroot
|
||||
elif $OPT_ROOT; then
|
||||
run_juju_as_root
|
||||
elif $OPT_DELETE; then
|
||||
delete_juju
|
||||
run_juju_as_root
|
||||
else
|
||||
run_juju_as_user
|
||||
fi
|
||||
|
|
|
|||
11
lib/core.sh
11
lib/core.sh
|
|
@ -28,10 +28,7 @@ set -e
|
|||
source "$(dirname ${BASH_ARGV[0]})/util.sh"
|
||||
|
||||
################################# VARIABLES ##############################
|
||||
if [ -z ${JUJU_HOME} ] || [ ! -d ${JUJU_HOME} ]
|
||||
then
|
||||
JUJU_HOME=~/.juju
|
||||
fi
|
||||
[ -z ${JUJU_HOME} ] && JUJU_HOME=~/.juju
|
||||
if [ -z ${JUJU_TEMPDIR} ] || [ ! -d ${JUJU_TEMPDIR} ]
|
||||
then
|
||||
JUJU_TEMPDIR=/tmp
|
||||
|
|
@ -85,8 +82,10 @@ function prepare_build_directory(){
|
|||
|
||||
|
||||
function _setup_juju(){
|
||||
mkdir -p "${JUJU_HOME}"
|
||||
[ "$(ls -A $JUJU_HOME)" ] && die "Error: JuJu has been already installed in $JUJU_HOME"
|
||||
|
||||
imagepath=$1
|
||||
mkdir -p ${JUJU_HOME}
|
||||
tar -zxpf ${imagepath} -C ${JUJU_HOME}
|
||||
mkdir -p ${JUJU_HOME}/run/lock
|
||||
info "JuJu installed successfully"
|
||||
|
|
@ -112,8 +111,6 @@ function setup_juju(){
|
|||
|
||||
function setup_from_file_juju(){
|
||||
# Setup from file the JuJu environment
|
||||
[ "$(ls -A $JUJU_HOME)" ] && die "Error: JuJu has been already installed in $JUJU_HOME"
|
||||
|
||||
local imagefile=$1
|
||||
[ ! -e ${imagefile} ] && die "Error: The JuJu image file ${imagefile} does not exist"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue