1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 04:43:00 +00:00
kiwi-scp/kiwi

69 lines
1.6 KiB
Text
Raw Normal View History

2020-08-04 00:56:29 +00:00
#!/bin/bash
#############
# CONSTANTS #
#############
2020-08-04 14:38:51 +00:00
# base config filename
export KIWI_CONF_NAME="kiwi.conf"
2020-08-04 00:56:29 +00:00
# base install dir
2020-08-04 14:38:51 +00:00
KIWI_BASEDIR="${HOME}/.cache/kiwi-config"
2020-08-04 00:56:29 +00:00
# repository uri
KIWI_REPO="https://github.com/ldericher/kiwi-config"
########
# MAIN #
########
# use latest version by default
2020-08-04 14:38:51 +00:00
export KIWI_VERSION="master"
2020-08-04 00:56:29 +00:00
# check if pwd is a kiwi folder
if [ -f "./${KIWI_CONF_NAME}" ]; then
# determine needed kiwi-config version
2020-08-04 14:38:51 +00:00
export KIWI_VERSION=$(source "./${KIWI_CONF_NAME}" && echo "${VERSION}")
2020-08-04 00:56:29 +00:00
fi
# install if kiwi-config not found
2020-08-04 14:38:51 +00:00
if [ ! -x "${KIWI_BASEDIR}/${KIWI_VERSION}/bin/main.sh" ]; then
echo -n "Installing kiwi-config v${KIWI_VERSION} into ${KIWI_BASEDIR} ... "
2020-08-04 00:56:29 +00:00
### production version ###
2020-08-04 14:38:51 +00:00
# # switch to temp dir
# workdir=$(pwd)
2020-08-04 00:56:29 +00:00
# tmpdir=$(mktemp -d)
2020-08-04 14:38:51 +00:00
# cd "${tmpdir}"
2020-08-04 00:56:29 +00:00
2020-08-04 14:38:51 +00:00
# # download archive
# wget "${KIWI_REPO}/archive/${KIWI_VERSION}.zip"
# unzip "${KIWI_VERSION}.zip"
2020-08-04 00:56:29 +00:00
2020-08-04 14:38:51 +00:00
# # read archive version tag
# cd "kiwi-config-${KIWI_VERSION}"
# export KIWI_VERSION=$(cat ./version-tag)
2020-08-04 00:56:29 +00:00
2020-08-04 14:38:51 +00:00
# # install archive
# mkdir -p "${KIWI_BASEDIR}"
# mv ./src "${KIWI_BASEDIR}/${KIWI_VERSION}"
2020-08-04 00:56:29 +00:00
# # discard temp dir
2020-08-04 14:38:51 +00:00
# cd "${workdir}"
2020-08-04 00:56:29 +00:00
# rm -rf "${tmpdir}"
### development version ###
2020-08-04 14:38:51 +00:00
# read this version tag
export KIWI_VERSION=$(cat ./version-tag)
2020-08-04 00:56:29 +00:00
2020-08-04 14:38:51 +00:00
# install this
mkdir -p "${KIWI_BASEDIR}"
ln -s "$(readlink -f ./src)" "${KIWI_BASEDIR}/${KIWI_VERSION}"
2020-08-04 00:56:29 +00:00
echo "OK"
fi
2020-08-04 14:38:51 +00:00
export KIWI_ROOT="${KIWI_BASEDIR}/${KIWI_VERSION}"
2020-08-04 00:56:29 +00:00
# run main script
2020-08-04 14:38:51 +00:00
exec "${KIWI_ROOT}/bin/main.sh" "${@}"