Browse Source

chg: dev: [pandachi-install] streamline installation and update in functions

rc1
Valentin Lab 5 years ago
parent
commit
d8a930123a
  1. 42
      bin/pandachi-install

42
bin/pandachi-install

@ -9,19 +9,40 @@ wget http://docker.0k.io/get/ -qO - | bash
exit 1 exit 1
} }
set -e
if ! [ -d "/opt/apps/pandachi-deploy" ]; then
mkdir -p /opt/apps && cd /opt/apps
git clone git.0k.io:/var/git/0k/pandachi-deploy.git
clone_or_update() {
local pkg="$1" branch=${2:-master} \
DEPLOY_PATH="/opt/apps" \
GIT_BASE="git.0k.io:/var/git/0k" \
current_branch
if [ -d "$DEPLOY_PATH/$pkg" ]; then
cd "$DEPLOY_PATH/$pkg"
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "$branch" ]; then
echo "Fatal: $DEPLOY_PATH/$pkg git repos has unexpected branch checkouted."
echo " To avoid changing thing, we prefer to bailout."
return 1
fi fi
if ! [ -d "/opt/apps/pandachi-manage" ]; then
mkdir -p /opt/apps && cd /opt/apps
git clone git.0k.io:/var/git/0k/pandachi-manage.git
git pull -r || return 1
else
mkdir -p "$DEPLOY_PATH" && cd "$DEPLOY_PATH"
git clone "$GIT_BASE/${pkg}" -b "$branch" --depth=1
fi fi
}
install_bin() {
local path="$1" DEST_PATH=/usr/local/bin
ln -sfnv "$path"/* "$DEST_PATH" || return 1
find -L "$DEST_PATH" -maxdepth 1 -type l -ilname "$path"/\* -exec rm -v {} \; || return 1
}
set -e
clone_or_update pandachi-manage || exit 1
install_bin /opt/apps/pandachi-manage/bin
clone_or_update pandachi-deploy || exit 1
ln -sfn /opt/apps/pandachi-manage/bin/* /usr/local/bin/
#[ -e /etc/compose.conf ] || ln -sfv /opt/apps/pandachi-deploy/etc/compose.conf /etc/compose.conf #[ -e /etc/compose.conf ] || ln -sfv /opt/apps/pandachi-deploy/etc/compose.conf /etc/compose.conf
@ -97,9 +118,8 @@ if [ "$MAIN_PASSWORD" ]; then
sed -ri "s/^(\s+admin-password:\s+).*$/\1$MAIN_PASSWORD/g" compose.yml sed -ri "s/^(\s+admin-password:\s+).*$/\1$MAIN_PASSWORD/g" compose.yml
fi fi
pip install ovh
ln -sf /opt/apps/pandachi-deploy/bin/* /usr/local/bin/
pip install ovh
#compose --debug up odoo apache #compose --debug up odoo apache

Loading…
Cancel
Save