function uninstall(){
service openvim stop
- for file in /opt/openvim /etc/default/openvimd.cfg /var/log/openvim /etc/systemd/system/openvim.service /usr/sbin/openvim
+ for file in /opt/openvim /etc/default/openvimd.cfg /var/log/openvim /etc/systemd/system/openvim.service /usr/sbin/openvim /usr/sbin/initopenvim /usr/sbin/openvim
do
rm -rf $file || ! echo "Can not delete '$file'. Needed root privileges?" >&2 || exit 1
done
cp -r $FILE /opt/openvim || ! echo $BAD_PATH_ERROR >&2 || exit 1
mkdir -p /opt/openvim/logs
rm -rf /usr/sbin/openvim
+rm -rf /usr/sbin/initopenvim
#cp ${FILE}/openvim /usr/sbin/ || ! echo $BAD_PATH_ERROR >&2 || exit 1
ln -s /opt/openvim/openvimd.cfg /etc/default/openvimd.cfg || echo "warning cannot create link '/etc/default/openvimd.cfg'"
ln -s /opt/openvim/logs /var/log/openvim || echo "warning cannot create link '/var/log/openvim'"
ln -s /opt/openvim/openvim /usr/sbin/openvim
+ln -s /opt/openvim/scripts/service-openvim.sh /usr/sbin/initopenvim
chown $USER_OWNER /opt/openvim/openvimd.cfg
chown -R $USER_OWNER /opt/openvim
-mkdir -p etc/systemd/system/
+mkdir -p /etc/systemd/system/
cat > /etc/systemd/system/openvim.service << EOF
[Unit]
Description=openvim server
[[ "$_DISTRO" == "CentOS" || "$_DISTRO" == "Red" ]] && yum install -y bash-completion
#su $SUDO_USER -c 'mkdir -p ~/.bash_completion.d'
su $SUDO_USER -c 'activate-global-python-argcomplete --user'
-if ! grep -q bash_completion.d/python-argcomplete.sh /home/${SUDO_USER}/.bashrc
+if ! grep -q bash_completion.d/python-argcomplete.sh ${HOME}/.bashrc
then
echo " inserting .bash_completion.d/python-argcomplete.sh execution at .bashrc"
- su $SUDO_USER -c 'echo ". /home/${USER}/.bash_completion.d/python-argcomplete.sh" >> ~/.bashrc'
+ su $SUDO_USER -c 'echo ". ${HOME}/.bash_completion.d/python-argcomplete.sh" >> ~/.bashrc'
fi
then
echo '
#################################################################
-##### CONFIGURE OPENMANO SERVICE #####
+##### CONFIGURE OPENVIM SERVICE #####
#################################################################'
./openvim/scripts/install-openvim-service.sh -f openvim #-u $SUDO_USER