mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-21 20:33:00 +00:00
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 #
|
||||
######################################
|
||||
|
||||
version: '0.1'
|
||||
version: '0.0.1'
|
||||
|
||||
runtime:
|
||||
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"
|
||||
|
||||
# dependencies to run kiwi-config
|
||||
KIWI_DEPS=(python3 pipenv less docker docker-compose)
|
||||
KIWI_DEPS=(docker docker-compose)
|
||||
# base install dir
|
||||
KIWI_BASEDIR="${HOME}/.cache/kiwi-config"
|
||||
KIWI_BASEDIR="${HOME}/.local/lib/kiwi-config"
|
||||
# per-user env setup script
|
||||
KIWI_ENVFILE="${HOME}/.kiwienv"
|
||||
|
||||
|
@ -59,7 +59,7 @@ fi
|
|||
|
||||
for dep in "${KIWI_DEPS[@]}"; do
|
||||
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
|
||||
fi
|
||||
done
|
||||
|
@ -79,49 +79,28 @@ fi
|
|||
if [ ! -x "$(kiwi_executable)" ]; then
|
||||
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
|
||||
# tmpdir=$(mktemp -d)
|
||||
# cd "${tmpdir}" || :
|
||||
# download archive
|
||||
curl -o "kiwi-config.zip" "${KIWI_REPO}/archive/${KIWI_VERSION}.zip"
|
||||
unzip "kiwi-config.zip"
|
||||
|
||||
# # download archive
|
||||
# wget "${KIWI_REPO}/archive/${KIWI_VERSION}.zip"
|
||||
# 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
|
||||
# read archive version tag
|
||||
cd "kiwi-config-${KIWI_VERSION}" || :
|
||||
KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
|
||||
|
||||
if [ -x "$(kiwi_executable)" ]; then
|
||||
# after version update: no need to install
|
||||
echo "kiwi-config v${KIWI_VERSION} found!"
|
||||
else
|
||||
# install this
|
||||
mkdir -p "${KIWI_BASEDIR}"
|
||||
ln -s "$(readlink -f .)" "$(kiwi_installdir)"
|
||||
# cd
|
||||
# install archive
|
||||
mkdir -p "$(kiwi_installdir)"
|
||||
mv "src" "Pipfile" "Pipfile.lock" "$(kiwi_installdir)/"
|
||||
|
||||
# discard temp dir
|
||||
cd "${WORKDIR}" || :
|
||||
rm -rf "${tmpdir}"
|
||||
|
||||
echo "OK"
|
||||
fi
|
||||
fi
|
||||
|
||||
# check virtualenv
|
||||
cd "$(kiwi_installdir)" || :
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.1
|
||||
0.0.1
|
Loading…
Reference in a new issue