Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
clive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
clive
Commits
0d32883d
Commit
0d32883d
authored
8 months ago
by
Bartek Wrona
Browse files
Options
Downloads
Patches
Plain Diff
issue
#251
- defined script to launch clive-TUI.
parent
37cbd702
No related branches found
No related tags found
2 merge requests
!455
V1.27.5.15 release
,
!442
issue #251 - defined script to launch clive-TUI.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
scripts/ci-helpers/generate_startup_scripts.sh
+12
-0
12 additions, 0 deletions
scripts/ci-helpers/generate_startup_scripts.sh
scripts/start_clive.sh.template
+112
-0
112 additions, 0 deletions
scripts/start_clive.sh.template
with
125 additions
and
0 deletions
.gitignore
+
1
−
0
View file @
0d32883d
...
@@ -35,6 +35,7 @@ share/python-wheels/
...
@@ -35,6 +35,7 @@ share/python-wheels/
.installed.cfg
.installed.cfg
*.egg
*.egg
MANIFEST
MANIFEST
scripts/start_clive.sh
# PyInstaller
# PyInstaller
# Usually these files are written by a python script from a template
# Usually these files are written by a python script from a template
...
...
This diff is collapsed.
Click to expand it.
scripts/ci-helpers/generate_startup_scripts.sh
0 → 100755
+
12
−
0
View file @
0d32883d
#!/bin/bash
set
-euo
pipefail
SCRIPTPATH
=
"
$(
cd
--
"
$(
dirname
"
$0
"
)
"
>
/dev/null 2>&1
||
exit
1
;
pwd
-P
)
"
IMAGE_NAME
=
${
1
:?
"Missing arg #1 to specify built docker image name"
}
ESCAPED_IMAGE_NAME
=
${
IMAGE_NAME
//\//\\/
}
cp
-f
"
${
SCRIPTPATH
}
/../start_clive.sh.template"
"
${
SCRIPTPATH
}
/../start_clive.sh"
sed
-i
-e
"s/<IMG_PLACEHOLDER>/
${
ESCAPED_IMAGE_NAME
}
/g"
"
${
SCRIPTPATH
}
/../start_clive.sh"
This diff is collapsed.
Click to expand it.
scripts/start_clive.sh.template
0 → 100755
+
112
−
0
View file @
0d32883d
#!/bin/bash
set
-euo
pipefail
# Script responsible for starting a docker container built for given image (optionally specified at command line).
print_help
()
{
echo
"Usage:
$0
[<docker_img>] [OPTION[=VALUE]]... [<clive_option>]..."
echo
echo
"Allows to start clive application in TUI mode."
echo
"OPTIONS:"
echo
" --data-dir=DIRECTORY_PATH Points a clive data directory to store profile data. Defaults to
${
HOME
}
/.clive directory"
echo
" --docker-option=OPTION Allows to specify additional docker option, to be passed to underlying docker run spawn."
echo
" --help Display this help screen and exit"
echo
}
DOCKER_ARGS
=()
CLIVE_ARGS
=()
IMAGE_NAME
=
"<IMG_PLACEHOLDER>"
CLIVE_DATA_DIR
=
"
${
HOME
}
/.clive"
add_docker_arg
()
{
local
arg
=
"
$1
"
DOCKER_ARGS+
=(
"
$arg
"
)
}
add_clive_arg
()
{
local
arg
=
"
$1
"
CLIVE_ARGS+
=(
"
$arg
"
)
}
while
[
$#
-gt
0
]
;
do
case
"
$1
"
in
--docker-option
=
*
)
options_string
=
"
${
1
#*=
}
"
IFS
=
" "
read
-ra
options
<<<
"
$options_string
"
for
option
in
"
${
options
[@]
}
"
;
do
add_docker_arg
"
$option
"
done
;;
--docker-option
)
shift
options_string
=
"
${
1
}
"
IFS
=
" "
read
-ra
options
<<<
"
$options_string
"
for
option
in
"
${
options
[@]
}
"
;
do
add_docker_arg
"
$option
"
done
;;
--data-dir
=
*
)
CLIVE_DATA_DIR
=
"
${
1
#*=
}
"
;;
--data-dir
)
shift
CLIVE_DATA_DIR
=
"
${
1
}
"
;;
--help
)
print_help
exit
0
;;
-
*
)
add_clive_arg
"
$1
"
;;
*
)
IMAGE_NAME
=
"
${
1
}
"
echo
"Using image name:
$IMAGE_NAME
"
;;
esac
shift
done
# Collect remaining command line args to pass to the container to run
CMD_ARGS
=(
"
$@
"
)
CMD_ARGS+
=(
"
${
CLIVE_ARGS
[@]
}
"
)
if
!
command
-v
docker &> /dev/null
then
echo
"Error: Missing docker tools"
echo
"Please consult documentation describing docker installation steps: https://docs.docker.com/engine/install/ubuntu/"
exit
1
fi
if
[
-z
"
${
CLIVE_DATA_DIR
}
"
]
then
echo
"Error: Missing --data-dir argument"
exit
2
fi
# try to create a profile directory, to correctly resolve realpath
mkdir
-p
"
${
CLIVE_DATA_DIR
}
"
chmod
-R
700
"
${
CLIVE_DATA_DIR
}
"
CLIVE_DATA_ABS_DIR
=
$(
realpath
"
${
CLIVE_DATA_DIR
}
"
)
# Supplement docker args by volume mapping
add_docker_arg
"--volume"
add_docker_arg
"
${
CLIVE_DATA_ABS_DIR
}
:/clive/.clive/"
CLIVE_DATA_LOCATION_DIR
=
$(
realpath
"
${
CLIVE_DATA_DIR
}
/../"
)
HOME_ABS_DIR
=
$(
realpath
"
${
HOME
}
"
)
if
[[
"
${
CLIVE_DATA_LOCATION_DIR
}
/"
=
${
HOME_ABS_DIR
}
/
*
]]
then
# if specified location of clive dir is inside user's home, lets add additional volume mapping to make it accessible to internally spawned clive
add_docker_arg
"--volume"
add_docker_arg
"
${
CLIVE_DATA_LOCATION_DIR
}
:
${
CLIVE_DATA_LOCATION_DIR
}
"
fi
docker run
--detach-keys
=
'ctrl-@,ctrl-q'
--rm
-it
-e
HIVED_UID
=
"
$(
id
-u
)
"
--stop-timeout
=
180
"
${
DOCKER_ARGS
[@]
}
"
"
${
IMAGE_NAME
}
"
"
${
CMD_ARGS
[@]
}
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment