Skip to content

Commit 51eb37a

Browse files
committed
Allow override install options
It's conceivable that people may want to fork and utilize their own copy of the aviary repository. Depending on the environment where it's being installed, various paths and other install-time options may need to be adjusted. Allow for this by accepting non-default values for key installer options. Also, disable existing cron entries with indication of what and when. Signed-off-by: Chris Evich <cevich@redhat.com>
1 parent a8ec9cf commit 51eb37a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

install

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
set -euo pipefail
44

55
function run() {
6-
VERSION=1.3.2
7-
INSTALL_PATH=/var/lib
8-
AV_PATH=$INSTALL_PATH/aviary/av
9-
RELEASE_URL=https://gitlab.com/dchester/aviary.sh/-/archive/${VERSION}/aviary.sh-${VERSION}.tar.gz
6+
VERSION="${VERSION:-1.3.2}"
7+
INSTALL_PATH="${INSTALL_PATH:-/var/lib/aviary}"
8+
AV_PATH="$INSTALL_PATH/av"
9+
RELEASE_URL="${RELEASE_URL:-https://gitlab.com/dchester/aviary.sh/-/archive/${VERSION}/aviary.sh-${VERSION}.tar.gz}"
1010
INVENTORY_GIT_URL=${1:-""}
11-
CONFIG_FILE=${INSTALL_PATH}/aviary/config
11+
CONFIG_FILE="${CONFIG_FILE:-${INSTALL_PATH}/config}"
1212

1313
# check for git dependency
1414
if ! /usr/bin/which git > /dev/null; then
@@ -20,23 +20,24 @@ function run() {
2020
echo "Installing with no inventory git url; set later in $CONFIG_FILE"
2121
fi
2222

23-
if [[ -e /var/lib/aviary ]]; then
23+
if [[ -d "$INSTALL_PATH" ]]; then
2424
echo "Found existing installation at $INSTALL_PATH; exiting"
2525
exit 1
2626
fi
2727

2828
echo Installing to ${INSTALL_PATH}...
29-
mkdir -p ${INSTALL_PATH}/aviary
30-
curl -s $RELEASE_URL | tar --strip-components=1 -C ${INSTALL_PATH}/aviary -xz
31-
ln -sf /var/lib/aviary/av /usr/bin/av
32-
mkdir -p ${INSTALL_PATH}/aviary/inventory
29+
mkdir -p ${INSTALL_PATH}
30+
curl -s $RELEASE_URL | tar --strip-components=1 -C ${INSTALL_PATH} -xz
31+
ln -sf "$AV_PATH" /usr/bin/av
32+
mkdir -p ${INSTALL_PATH}/inventory
3333

3434
if [[ ! -z "$INVENTORY_GIT_URL" ]]; then
3535
echo "inventory_git_url=$INVENTORY_GIT_URL" >> $CONFIG_FILE
3636
fi
3737

3838
echo Adding entry to /etc/crontab...
39-
echo "$(cat /etc/crontab | grep -v $AV_PATH)" > /etc/crontab
39+
NOW="$(date --iso-8601=minutes)"
40+
sed -r -e "s|^(.*"$AV_PATH".*)|\# $NOW install disabled: \1|" /etc/crontab
4041
echo "* * * * * root $AV_PATH directive >> /var/log/aviary-directive.log 2>&1" >> /etc/crontab
4142
echo "$(( RANDOM % 60 )) * * * * root $AV_PATH apply >> /var/log/aviary.log 2>&1" >> /etc/crontab
4243

0 commit comments

Comments
 (0)