v0.0.1: First release, not expected to be fully functional
This commit is contained in:
parent
772c22a49a
commit
eafc4ae55c
5 changed files with 130 additions and 43 deletions
23
README.md
Normal file
23
README.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# kiwi-config
|
||||||
|
|
||||||
|
The simple tool for managing container servers
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
- Learn to use `docker` with `docker-compose`
|
||||||
|
- Install kiwi-config
|
||||||
|
- Look at [the example instance](../example)
|
||||||
|
- Look at the output of `kiwi --help`
|
||||||
|
- Start building your own instances
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
curl 'https://raw.githubusercontent.com/ldericher/kiwi-config/master/install.sh' | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
That script checks for the basic dependencies of the `kiwi` command, then downloads the main script and installs it to a location of your choice. Please consider installing `kiwi` into a directory inside your $PATH.
|
||||||
|
|
||||||
|
## Get started
|
||||||
|
|
||||||
|
TODO
|
|
@ -2,7 +2,7 @@
|
||||||
# kiwi-config instance configuration #
|
# kiwi-config instance configuration #
|
||||||
######################################
|
######################################
|
||||||
|
|
||||||
version: '0.1'
|
version: '0.0.1'
|
||||||
|
|
||||||
runtime:
|
runtime:
|
||||||
storage: /tmp/kiwi
|
storage: /tmp/kiwi
|
||||||
|
|
85
install.sh
Executable file
85
install.sh
Executable file
|
@ -0,0 +1,85 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#############
|
||||||
|
# CONSTANTS #
|
||||||
|
#############
|
||||||
|
|
||||||
|
# dependencies to run kiwi-config
|
||||||
|
KIWI_DEPS="bash python3 pipenv less"
|
||||||
|
|
||||||
|
##########
|
||||||
|
# CHECKS #
|
||||||
|
##########
|
||||||
|
|
||||||
|
printf "checking dependencies ... "
|
||||||
|
|
||||||
|
for dep in ${KIWI_DEPS}; do
|
||||||
|
printf "%s, " "${dep}"
|
||||||
|
|
||||||
|
if ! command -v "${dep}" >/dev/null 2>/dev/null; then
|
||||||
|
echo
|
||||||
|
echo "Dependency '${dep}' not found, please install!" >/dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "OK"
|
||||||
|
|
||||||
|
########
|
||||||
|
# MAIN #
|
||||||
|
########
|
||||||
|
|
||||||
|
# prompt for installation directory
|
||||||
|
install_dir_default="/usr/local/bin"
|
||||||
|
valid="no"
|
||||||
|
|
||||||
|
while [ "${valid}" = "no" ]; do
|
||||||
|
printf "Select installation directory [Default: '%s']: " "${install_dir_default}"
|
||||||
|
read install_dir
|
||||||
|
install_dir="${install_dir:-${install_dir_default}}"
|
||||||
|
|
||||||
|
# check
|
||||||
|
if [ -d "${install_dir}" ]; then
|
||||||
|
valid="yes"
|
||||||
|
|
||||||
|
else
|
||||||
|
printf "Install directory doesn't exist. Try creating? [Y|n] "
|
||||||
|
read yesno
|
||||||
|
if [ ! "${yesno}" = "N" ] || [ ! "${yesno}" = "n" ]; then
|
||||||
|
|
||||||
|
# check creation failure
|
||||||
|
if mkdir -p "${install_dir}"; then
|
||||||
|
valid="yes"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Invalid install directory." >/dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# start actual installation
|
||||||
|
printf "Installing into '%s' ... " "${install_dir}"
|
||||||
|
|
||||||
|
# install "kiwi" script
|
||||||
|
uri="https://raw.githubusercontent.com/ldericher/kiwi-config/master/kiwi"
|
||||||
|
tmp_file="$(mktemp)"
|
||||||
|
|
||||||
|
if ! curl -o "${tmp_file}" "${uri}" >/dev/null 2>/dev/null; then
|
||||||
|
rm "${tmp_file}"
|
||||||
|
echo "Download 'kiwi' failed!" >/dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! install -m 0755 "${tmp_file}" "${install_dir}/kiwi"; then
|
||||||
|
rm "${tmp_file}"
|
||||||
|
echo "Install 'kiwi' failed!" >/dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm "${tmp_file}"
|
||||||
|
|
||||||
|
# finalization
|
||||||
|
echo "OK"
|
||||||
|
exit 0
|
59
kiwi
59
kiwi
|
@ -10,9 +10,9 @@ KIWI_CONF_NAME="kiwi.yml"
|
||||||
KIWI_VERSION_TAG="etc/version_tag"
|
KIWI_VERSION_TAG="etc/version_tag"
|
||||||
|
|
||||||
# dependencies to run kiwi-config
|
# dependencies to run kiwi-config
|
||||||
KIWI_DEPS=(python3 pipenv less docker docker-compose)
|
KIWI_DEPS=(docker docker-compose)
|
||||||
# base install dir
|
# base install dir
|
||||||
KIWI_BASEDIR="${HOME}/.cache/kiwi-config"
|
KIWI_BASEDIR="${HOME}/.local/lib/kiwi-config"
|
||||||
# per-user env setup script
|
# per-user env setup script
|
||||||
KIWI_ENVFILE="${HOME}/.kiwienv"
|
KIWI_ENVFILE="${HOME}/.kiwienv"
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ fi
|
||||||
|
|
||||||
for dep in "${KIWI_DEPS[@]}"; do
|
for dep in "${KIWI_DEPS[@]}"; do
|
||||||
if ! command -v "${dep}" &>/dev/null; then
|
if ! command -v "${dep}" &>/dev/null; then
|
||||||
echo "Dependency '${dep}' not found, please install!"
|
echo "Dependency '${dep}' not found, please install!" >/dev/stderr
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -79,48 +79,27 @@ fi
|
||||||
if [ ! -x "$(kiwi_executable)" ]; then
|
if [ ! -x "$(kiwi_executable)" ]; then
|
||||||
echo -n "Installing kiwi-config v${KIWI_VERSION} into ${KIWI_BASEDIR} ... "
|
echo -n "Installing kiwi-config v${KIWI_VERSION} into ${KIWI_BASEDIR} ... "
|
||||||
|
|
||||||
### TODO: post-release version ###
|
# switch to temp dir
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
cd "${tmpdir}" || :
|
||||||
|
|
||||||
# # switch to temp dir
|
# download archive
|
||||||
# tmpdir=$(mktemp -d)
|
curl -o "kiwi-config.zip" "${KIWI_REPO}/archive/${KIWI_VERSION}.zip"
|
||||||
# cd "${tmpdir}" || :
|
unzip "kiwi-config.zip"
|
||||||
|
|
||||||
# # download archive
|
# read archive version tag
|
||||||
# wget "${KIWI_REPO}/archive/${KIWI_VERSION}.zip"
|
cd "kiwi-config-${KIWI_VERSION}" || :
|
||||||
# unzip "${KIWI_VERSION}.zip"
|
|
||||||
|
|
||||||
# # read archive version tag
|
|
||||||
# cd "kiwi-config-${KIWI_VERSION}" || :
|
|
||||||
# KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
|
|
||||||
|
|
||||||
# # install archive
|
|
||||||
# mkdir -p "$(kiwi_installdir)"
|
|
||||||
# mv "src" "Pipfile" "Pipfile.lock" "$(kiwi_installdir)/"
|
|
||||||
|
|
||||||
# # discard temp dir
|
|
||||||
# cd "${WORKDIR}" || :
|
|
||||||
# rm -rf "${tmpdir}"
|
|
||||||
|
|
||||||
# echo "OK"
|
|
||||||
|
|
||||||
### pre-release version ###
|
|
||||||
|
|
||||||
# use this directory as archive
|
|
||||||
cd "$(dirname "$(readlink -f "${0}")")" || :
|
|
||||||
|
|
||||||
# read this version tag
|
|
||||||
KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
|
KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
|
||||||
|
|
||||||
if [ -x "$(kiwi_executable)" ]; then
|
# install archive
|
||||||
# after version update: no need to install
|
mkdir -p "$(kiwi_installdir)"
|
||||||
echo "kiwi-config v${KIWI_VERSION} found!"
|
mv "src" "Pipfile" "Pipfile.lock" "$(kiwi_installdir)/"
|
||||||
else
|
|
||||||
# install this
|
# discard temp dir
|
||||||
mkdir -p "${KIWI_BASEDIR}"
|
cd "${WORKDIR}" || :
|
||||||
ln -s "$(readlink -f .)" "$(kiwi_installdir)"
|
rm -rf "${tmpdir}"
|
||||||
# cd
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check virtualenv
|
# check virtualenv
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.1
|
0.0.1
|
Loading…
Reference in a new issue