Update install.sh
This commit is contained in:
parent
ff7280c632
commit
c2f7c80c7e
|
@ -14,16 +14,58 @@ SBINS="opensipsctl opensipsunix osipsconfig opensips opensipsdbctl osipsconsole"
|
||||||
BINNAME="opensips"
|
BINNAME="opensips"
|
||||||
RELEASEBIN="opensips.run"
|
RELEASEBIN="opensips.run"
|
||||||
|
|
||||||
echo "Install opensips..."
|
|
||||||
|
|
||||||
if [ $UID -ne 0 ]; then
|
if [ $UID -ne 0 ]; then
|
||||||
echo "Superuser privileges are required to run this script."
|
echo "Superuser privileges are required to run this script."
|
||||||
echo "e.g. \"sudo ./$RELEASEBIN\""
|
echo "e.g. \"sudo ./$RELEASEBIN\""
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$1" ];then
|
||||||
|
if [ $1 = "install" ];then
|
||||||
|
echo "Install opensips..."
|
||||||
|
elif [ $1 = "uninstall" ];then
|
||||||
|
echo "Uninstall opensips..."
|
||||||
|
for file in $SBINS;do
|
||||||
|
if [ -f "/$BINDIR/$file" ];then
|
||||||
|
echo "uninstall /$BINDIR/$file"
|
||||||
|
rm -f /$BINDIR/$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -d "/$LIBDIR/$BINNAME" ];then
|
||||||
|
echo "removing /$LIBDIR/$BINNAME"
|
||||||
|
rm -rf /$LIBDIR/$BINNAME
|
||||||
|
fi
|
||||||
|
echo "Uninstall completed."
|
||||||
|
exit 0
|
||||||
|
elif [ $1 = "purge" ];then
|
||||||
|
echo "Purge opensips..."
|
||||||
|
for file in $SBINS;do
|
||||||
|
if [ -f "/$BINDIR/$file" ];then
|
||||||
|
echo "purge /$BINDIR/$file"
|
||||||
|
rm -f /$BINDIR/$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -d "/$LIBDIR/$BINNAME" ];then
|
||||||
|
echo "purge /$LIBDIR/$BINNAME"
|
||||||
|
rm -rf /$LIBDIR/$BINNAME
|
||||||
|
fi
|
||||||
|
if [ -d "/$ETCDIR/$BINNAME" ];then
|
||||||
|
echo "purge /$ETCDIR/$BINNAME"
|
||||||
|
rm -rf /$ETCDIR/$BINNAME
|
||||||
|
fi
|
||||||
|
echo "Purge completed."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Unknow param, exit."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Install opensips..."
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "Checking for a supported OS... \c"
|
echo -e "Checking for a supported OS... \c"
|
||||||
|
|
||||||
|
FAIL="true"
|
||||||
if [ "$(echo -e $(cat /etc/issue |head -n1)|head -n1)" = "$(cat os)" ];then
|
if [ "$(echo -e $(cat /etc/issue |head -n1)|head -n1)" = "$(cat os)" ];then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
FAIL="false"
|
FAIL="false"
|
||||||
|
@ -34,15 +76,21 @@ else
|
||||||
FAIL="false"
|
FAIL="false"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! $FAIL = "false" ];then
|
|
||||||
|
# disable os check.
|
||||||
|
if [ ! "$FAIL" = "false" ];then
|
||||||
|
echo "OK"
|
||||||
|
FAIL="false"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! "$FAIL" = "false" ];then
|
||||||
echo "This file can only installed on $(cat os), abort."
|
echo "This file can only installed on $(cat os), abort."
|
||||||
FAIL="true"
|
FAIL="true"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ignore OS check.
|
if [ ! $FAIL = "true" ]; then
|
||||||
FAIL="false"
|
|
||||||
echo "OK"
|
|
||||||
|
|
||||||
echo -e "Checking for a 64-bit OS... \c"
|
echo -e "Checking for a 64-bit OS... \c"
|
||||||
|
|
||||||
|
@ -54,6 +102,8 @@ else
|
||||||
FAIL="true"
|
FAIL="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $FAIL = "true" ];then
|
if [ $FAIL = "true" ];then
|
||||||
echo "Aborting installation due to unsatisfied requirements."
|
echo "Aborting installation due to unsatisfied requirements."
|
||||||
echo "Installation failed."
|
echo "Installation failed."
|
||||||
|
@ -82,4 +132,3 @@ fi
|
||||||
cp -r $LIBDIR/$BINNAME /$LIBDIR/$BINNAME
|
cp -r $LIBDIR/$BINNAME /$LIBDIR/$BINNAME
|
||||||
|
|
||||||
echo "Done. Please edit necessary configures to run opensips."
|
echo "Done. Please edit necessary configures to run opensips."
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue