add init script

This commit is contained in:
tianyu 2014-11-13 14:13:22 +08:00
parent 057a58eb2a
commit d4b69f6245
1 changed files with 11 additions and 0 deletions

View File

@ -121,6 +121,17 @@ done
if [ -d "/$ETCDIR/$BINNAME" ];then
echo "/$ETCDIR/$BINNAME already exist, make backup."
mv /$ETCDIR/$BINNAME /$ETCDIR/$BINNAME.backup-$(date +%F-%H-%M-%S)
echo "install $BINNAME.default to /$ETCDIR/default/$BINNAME..."
cp $ETCDIR/default/$BINNAME.default /$ETCDIR/default/$BINNAME
echo "install $BINNAME.init to /$ETCDIR/init.d/$BINNAME..."
cp $ETCDIR/init.d/$BINNAME.init /$ETCDIR/init.d/$BINNAME
chmod +x /$ETCDIR/init.d/$BINNAME
if [ -n $(command -v apt-get) ]; then
bash $ETCDIR/$BINNAME.postinst configure
elif [ -n $(command -v yum) ]; then
bash $ETCDIR/$BINNAME.postinst configure
passwd -l opensips
fi
fi
cp -r $ETCDIR/$BINNAME /$ETCDIR