Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
feudal
feudalClientInstaller
Commits
831f7b4a
Commit
831f7b4a
authored
Nov 13, 2019
by
Marcus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
install script
parent
be8243d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
0 deletions
+121
-0
install.sh
install.sh
+121
-0
No files found.
install.sh
0 → 100755
View file @
831f7b4a
#!/bin/bash
SERVICE
=
"feudalClient"
LIB_SYSD
=
"/lib/systemd/system"
SYSD_SERVICE
=
feudalClient.service
USER
=
"feudal"
ETC_CONFIG
=
/etc/feudal
ADAPTER_BRANCH
=
remove-marcus-legacy
GOPATH
=
/tmp/go
INSTALLDIR
=
/tmp/feudalClientInstaller
pushd
./
>
/dev/null
test
-e
${
INSTALLDIR
}
||
mkdir
-p
${
INSTALLDIR
}
### find pip
PIP
=
`
which pip3
`
test
-z
$PIP
&&
{
PIP
=
`
which pip
`
test
-z
$PIP
&&
{
echo
-e
"pip not found.
\n
=> apt-get install python3-pip"
exit
1
}
}
### Add feudal user
echo
"Adding user
${
USER
}
"
useradd
-m
${
USER
}
>
/dev/null 2>&1
RV
=
$?
case
"
$RV
"
in
0-8
)
echo
"Error creating user"
;
exit
1
;;
10-14
)
echo
"Error creating user"
;
exit
1
;;
esac
### Install feudalClient
test
-e
${
INSTALLDIR
}
/feudalClient/feudalClient
&&
{
echo
-e
"feudalClient seems to be installed already, skipping"
}
test
-e
${
INSTALLDIR
}
/feudalClient/feudalClient
||
{
echo
-e
"
\n
building feudalClient"
cd
${
INSTALLDIR
}
git clone https://git.scc.kit.edu/feudal/feudalClient.git
>
/dev/null 2>&1
cd
feudalClient
go get
go build
echo
-e
"Installing feudalClient"
USER_HOME
=
`
eval echo
"~
${
USER
}
"
`
install
-m
755
-o
${
USER
}
-d
${
USER_HOME
}
/bin/
install
-m
755
-o
${
USER
}
feudalClient
${
USER_HOME
}
/bin/feudalClient
echo
-e
"feudalClient installed"
}
### Install feudalAdapterLDF
echo
-e
"
\n
Installing feudalAdapterLDF"
cd
${
INSTALLDIR
}
test
-d
feudalAdapterLDF
||
{
git clone https://git.scc.kit.edu/feudal/feudalAdapterLDF
>
/dev/null 2>&1
}
cd
feudalAdapterLDF
git co
${
ADAPTER_BRANCH
}
>
/dev/null 2>&1
git pull
>
/dev/null 2>&1
./setup.py sdist
>
/dev/null
FULLNAME
=
`
python3 setup.py
--fullname
`
pip
install
dist/
$FULLNAME
.tar.gz
>
/dev/null
echo
-e
"feudalAdapterLDF installed"
# => ldf_adapter is now in $PATH
### Prepare config
cd
${
INSTALLDIR
}
test
-d
${
ETC_CONFIG
}
||
{
echo
"Creating template
${
ETC_CONFIG
}
and copying defaults there"
mkdir
-p
${
ETC_CONFIG
}
chown
-R
${
USER
}
${
ETC_CONFIG
}
echo
"You will have to edit the template files in the config"
}
### Install Config Files
test
-e
${
ETC_CONFIG
}
/ldf_adapter.conf
||
{
echo
"Installing a template for ldf_adapter.conf in
${
ETC_CONFIG
}
"
echo
" => You need to edit this file"
cp
feudalAdapterLDF/ldf_adapter_template.conf
${
ETC_CONFIG
}
}
popd
>
/dev/null
test
-e
${
ETC_CONFIG
}
/client_config.json
||
{
echo
"Installing a template for client_config_template.json in
${
ETC_CONFIG
}
"
echo
" => You need to edit this file"
cp
client_config_template.json
${
ETC_CONFIG
}
}
test
-e
${
ETC_CONFIG
}
/environment
||
{
echo
"Installing a template for environment in
${
ETC_CONFIG
}
"
cp
environment
${
ETC_CONFIG
}
}
# Ensure config permissions
chown
-R
${
USER
}
${
ETC_CONFIG
}
### Install systemd Service
echo
-e
"
\n
Installing / updating systemd service for
${
SYSD_SERVICE
}
"
test
-e
${
LIB_SYSD
}
/
${
SERVICE
}
.service
&&
{
diff
-q
${
SYSD_SERVICE
}
${
LIB_SYSD
}
>
/dev/null
||
{
echo
"Preparing systemd service for update"
rm
-f
${
LIB_SYSD
}
/
${
SERVICE
}
.service
}
}
test
-e
${
LIB_SYSD
}
/
${
SERVICE
}
.service
||
{
cp
${
SYSD_SERVICE
}
${
LIB_SYSD
}
/
${
SERVICE
}
.service
systemctl daemon-reload
}
echo
-e
"Done
\n
Restarting
${
SYSD_SERVICE
}
"
systemctl
enable
$SERVICE
systemctl restart
$SERVICE
echo
"Done"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment