Merge "Fixing installation for Ubuntu 16.04"

This commit is contained in:
Jenkins 2017-06-08 20:17:37 +00:00 committed by Gerrit Code Review
commit 577474c9c0
3 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,11 @@
[Unit]
Description=etcd key value store
[Service]
Type=notify
ExecStart=/usr/local/bin/etcd
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=Valence Server
[Service]
Environment=PYTHON_HOME=/usr/local/bin/valence
ExecStart=/usr/local/bin/valence
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -29,6 +29,10 @@ sed "s/\${CHUID}/$CURR_USER/" "$DIR"/etc/services-startup-conf/valence.conf > /
# Use alternate sed delimiter because path will have /
sed -i "s#PYHOME#$PYHOME#" /tmp/valence.conf
mv /tmp/valence.conf /etc/init/valence.conf
# Valence service file required at this path for starting service using systemctl
if [ -d "/etc/systemd/system" ]; then
cp "$DIR"/etc/services-startup-conf/valence.service /etc/systemd/system/valence.service
fi
# Generate initial sample config file.
echo "Generating sample config file" >> $install_log
@ -41,7 +45,7 @@ if [ ! -d "/etc/valence" ]; then
fi
chown "$CURR_USER":"$CURR_USER" /etc/valence
VALENCE_CONF=/etc/valence/valence.conf
cp etc/valence.conf.sample /etc/valence/valence.conf
cp "$DIR"/etc/valence.conf.sample /etc/valence/valence.conf
sudo sed -i "s/#debug\s*=.*/debug=true/" $VALENCE_CONF
sudo sed -i "s/#log_level\s*=.*/log_level=debug/" $VALENCE_CONF
@ -69,16 +73,23 @@ curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/
mkdir -p /var/etcd && tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /var/etcd --strip-components=1
chown "$CURR_USER":"$CURR_USER" /var/etcd
mv /var/etcd/etcd /usr/local/bin/etcd && mv /var/etcd/etcdctl /usr/local/bin/etcdctl
# Etcd service file required at this path for starting service using systemctl
if [ -d "/etc/systemd/system" ]; then
cp "$DIR"/etc/services-startup-conf/etcd.service /etc/systemd/system/etcd.service
fi
sed "s/\${CHUID}/$CURR_USER/" "$DIR"/etc/services-startup-conf/etcd.conf > /etc/init/etcd.conf
echo "Starting etcd database" >> $install_log
service etcd start
ETCD_STATUS=$?
sleep 2
timeout=30
attempt=1
until [[ $(service etcd status) = "etcd start/running"* ]]
until [[ $ETCD_STATUS = 0 ]]
do
service etcd status
ETCD_STATUS=$?
sleep 1
attempt=$((attempt+1))
if [[ $attempt -eq timeout ]]