mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-22 04:43:00 +00:00
silent multiversion installer
This commit is contained in:
parent
b92adfaf4b
commit
bd71a6dea4
4 changed files with 85 additions and 0 deletions
13
bin/main.sh
Executable file
13
bin/main.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!"
|
||||||
|
|
||||||
|
echo "This is ${0}."
|
||||||
|
|
||||||
|
echo "A.K.A. $(readlink -f ${0})."
|
||||||
|
|
||||||
|
echo "Arguments are:"
|
||||||
|
|
||||||
|
for an_arg in "${@}" ; do
|
||||||
|
echo "- ${an_arg}"
|
||||||
|
done
|
70
kiwi
Executable file
70
kiwi
Executable file
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#############
|
||||||
|
# CONSTANTS #
|
||||||
|
#############
|
||||||
|
|
||||||
|
# base config filename (constant)
|
||||||
|
KIWI_CONF_NAME="kiwi.conf"
|
||||||
|
# base install dir
|
||||||
|
KIWI_BASEDIR="${HOME}/.cache/kiwi-config-bin"
|
||||||
|
# repository uri
|
||||||
|
KIWI_REPO="https://github.com/ldericher/kiwi-config"
|
||||||
|
|
||||||
|
########
|
||||||
|
# MAIN #
|
||||||
|
########
|
||||||
|
|
||||||
|
# use latest version by default
|
||||||
|
version="master"
|
||||||
|
|
||||||
|
# check if pwd is a kiwi folder
|
||||||
|
if [ -f "./${KIWI_CONF_NAME}" ]; then
|
||||||
|
# determine needed kiwi-config version
|
||||||
|
version=$(source "./${KIWI_CONF_NAME}" && echo "v${VERSION}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install if kiwi-config not found
|
||||||
|
if [ ! -x "${KIWI_BASEDIR}/${version}/main.sh" ]; then
|
||||||
|
echo -n "Installing kiwi-config ${version} into ${KIWI_BASEDIR} ... "
|
||||||
|
|
||||||
|
### production version ###
|
||||||
|
|
||||||
|
# # create temp dir
|
||||||
|
# tmpdir=$(mktemp -d)
|
||||||
|
|
||||||
|
# (
|
||||||
|
# cd "${tmpdir}"
|
||||||
|
|
||||||
|
# # download archive
|
||||||
|
# wget "${KIWI_REPO}/archive/${version}.zip"
|
||||||
|
# unzip "${version}.zip"
|
||||||
|
|
||||||
|
# # read archive version tag
|
||||||
|
# cd "kiwi-config-${version}"
|
||||||
|
# version=$(cat ./version-tag)
|
||||||
|
|
||||||
|
# # install archive
|
||||||
|
# mkdir -p "${KIWI_BASEDIR}"
|
||||||
|
# mv ./bin "${KIWI_BASEDIR}/${version}"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# # discard temp dir
|
||||||
|
# rm -rf "${tmpdir}"
|
||||||
|
|
||||||
|
### development version ###
|
||||||
|
|
||||||
|
(
|
||||||
|
# read this version tag
|
||||||
|
version=$(cat ./version-tag)
|
||||||
|
|
||||||
|
# install this
|
||||||
|
mkdir -p "${KIWI_BASEDIR}"
|
||||||
|
ln -s "$(readlink -f ./bin)" "${KIWI_BASEDIR}/${version}"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "OK"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run main script
|
||||||
|
exec "${KIWI_BASEDIR}/${version}/main.sh" "${@}"
|
1
kiwi.conf
Normal file
1
kiwi.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
VERSION="0.1"
|
1
version-tag
Normal file
1
version-tag
Normal file
|
@ -0,0 +1 @@
|
||||||
|
v0.1
|
Loading…
Reference in a new issue