Remove binaries from gh-pages branch

This commit is contained in:
Wind4
2016-10-24 22:39:04 +08:00
parent a2dea2d90e
commit 2c61e12d97
6 changed files with 366 additions and 3 deletions

View File

@ -0,0 +1,77 @@
#!/bin/sh
#
# VLMCSD - this script starts and stops the KMS Server daemon
#
### BEGIN INIT INFO
# Provides: vlmcsd
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: KMS Emulator in C
### END INIT INFO
NAME=vlmcsd
SCRIPT=/usr/bin/vlmcsd
RUNAS=
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
start() {
if [ -f "$PIDFILE" ] && kill -0 $(cat "$PIDFILE"); then
echo 'Service already running.'
return 1
fi
echo 'Starting service...'
local CMD="$SCRIPT -p $PIDFILE -l $LOGFILE"
su -c "$CMD" $RUNAS
echo 'Service started.'
}
stop() {
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
echo 'Service not running.'
return 1
fi
echo 'Stopping service...'
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
echo 'Service stopped.'
}
status() {
echo "Checking $NAME service..."
if [ -f "$PIDFILE" ]; then
local PID=$(cat "$PIDFILE")
kill -0 $PID
if [ $? -eq 0 ]; then
echo "Running, the PID is $PID."
else
echo 'The process appears to be dead but pidfile still exists.'
fi
else
echo 'Service not running.'
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,81 @@
#!/bin/sh
#
# VLMCSD - this script starts and stops the KMS Server daemon
#
### BEGIN SERVICE INFO
# Run level information:
# chkconfig: 2345 99 99
# description: KMS Emulator in C
# processname: vlmcsd
### END SERVICE INFO
# Source function library
source /etc/init.d/functions
# Check that networking is up.
[ ${NETWORKING} ="yes" ] || exit 0
NAME=vlmcsd
SCRIPT=/usr/bin/vlmcsd
RUNAS=
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
start() {
if [ -f "$PIDFILE" ] && kill -0 $(cat "$PIDFILE"); then
echo 'Service already running.'
return 1
fi
echo 'Starting service...'
local CMD="$SCRIPT -p $PIDFILE -l $LOGFILE"
su -c "$CMD" $RUNAS
echo 'Service started.'
}
stop() {
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
echo 'Service not running.'
return 1
fi
echo 'Stopping service...'
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
echo 'Service stopped.'
}
status() {
echo "Checking $NAME service..."
if [ -f "$PIDFILE" ]; then
local PID=$(cat "$PIDFILE")
kill -0 $PID
if [ $? -eq 0 ]; then
echo "Running, the PID is $PID."
else
echo 'The process appears to be dead but pidfile still exists.'
fi
else
echo 'Service not running.'
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0

64
scripts/install-debian.sh Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash
#
# Install a VLMCSD service for Debian/Ubuntu
#
# Author: Wind4 (puxiaping@gmail.com)
# Date: November 30, 2015
#
check_result() {
if [ $1 -ne 0 ]; then
echo "Error: $2" >&2
exit $1
fi
}
if [ "x$(id -u)" != 'x0' ]; then
echo 'Error: This script can only be executed by root'
exit 1
fi
if [ -f '/etc/init.d/vlmcsd' ]; then
echo 'VLMCSD service has been installed.'
exit 1
fi
if [ ! -f '/usr/bin/wget' ]; then
echo 'Installing wget ...'
apt-get -qq update
apt-get -qq install -y wget
check_result $? "Can't install wget."
echo 'Install wget succeed.'
fi
TMP_DIR=`mktemp -d`
cd ${TMP_DIR}
echo 'Downloading vlmcsd binaries ...'
wget -q https://github.com/Wind4/vlmcsd/releases/download/svn1085/binaries.tar.gz -O binaries.tar.gz
check_result $? 'Download vlmcsd failed.'
echo 'Downloading startup script ...'
wget -q https://wind4.github.io/vlmcsd/scripts/init.d/vlmcsd-debian -O vlmcsd.init
check_result $? 'Download startup script failed.'
echo 'Extract vlmcsd ...'
tar zxf binaries.tar.gz
cp binaries/Linux/intel/static/vlmcsd-x86-musl-static /usr/bin/vlmcsd
cp vlmcsd.init /etc/init.d/vlmcsd
echo 'Fix Permissions ...'
chmod 755 /usr/bin/vlmcsd
chown root.root /usr/bin/vlmcsd
chmod 755 /etc/init.d/vlmcsd
chown root.root /etc/init.d/vlmcsd
echo 'Configuring deamon ...'
update-rc.d vlmcsd defaults
service vlmcsd start
check_result $? 'Installation failed.'
echo 'Cleaning ...'
rm -rf ${TMP_DIR}
echo 'Installed successfully.'

71
scripts/install-rhel.sh Normal file
View File

@ -0,0 +1,71 @@
#!/bin/bash
#
# Install a VLMCSD service for CentOS/RedHat
#
# Author: Wind4 (puxiaping@gmail.com)
# Date: November 30, 2015
#
check_result() {
if [ $1 -ne 0 ]; then
echo "Error: $2" >&2
exit $1
fi
}
if [ "x$(id -u)" != 'x0' ]; then
echo 'Error: This script can only be executed by root'
exit 1
fi
if [ -f '/etc/init.d/vlmcsd' ]; then
echo 'VLMCSD service has been installed.'
exit 1
fi
if [ ! -f '/usr/bin/wget' ]; then
echo 'Installing wget ...'
yum -q -y install wget
check_result $? "Can't install wget."
echo 'Install wget succeed.'
fi
if [ ! -f '/sbin/service' ]; then
echo 'Installing initscripts ...'
yum -q -y install initscripts
check_result $? "Can't install initscripts."
echo 'Install initscripts succeed.'
fi
TMP_DIR=`mktemp -d`
cd ${TMP_DIR}
echo 'Downloading vlmcsd ...'
wget -q https://github.com/Wind4/vlmcsd/releases/download/svn1085/binaries.tar.gz -O binaries.tar.gz
check_result $? 'Download vlmcsd failed.'
echo 'Downloading startup script ...'
wget -q https://wind4.github.io/vlmcsd/scripts/init.d/vlmcsd-rhel -O vlmcsd.init
check_result $? 'Download startup script failed.'
echo 'Extract vlmcsd ...'
tar zxf binaries.tar.gz
cp binaries/Linux/intel/static/vlmcsd-x86-musl-static /usr/bin/vlmcsd
cp vlmcsd.init /etc/init.d/vlmcsd
echo 'Fix Permissions ...'
chmod 755 /usr/bin/vlmcsd
chown root.root /usr/bin/vlmcsd
chmod 755 /etc/init.d/vlmcsd
chown root.root /etc/init.d/vlmcsd
echo 'Configuring deamon ...'
chkconfig --add vlmcsd
chkconfig vlmcsd on
service vlmcsd start
check_result $? 'Installation failed.'
echo 'Cleaning ...'
rm -rf ${TMP_DIR}
echo 'Installed successfully.'

51
scripts/install.sh Normal file
View File

@ -0,0 +1,51 @@
#!/bin/sh
#
# VLMCSD - CentOS/Debian/RedHat/Ubuntu installer
#
# Author: Wind4 (puxiaping@gmail.com)
# Date: November 30, 2015
#
# Detect OS
if [ -f /etc/debian_version ]; then
ostype='debian'
elif [ -f /etc/lsb-release ]; then
ostype='ubuntu'
elif [ -f /etc/redhat-release ]; then
ostype='rhel'
else
echo 'This script only support CentOS/Debian/RedHat/Ubuntu.' >&2
exit 1
fi
# Checking wget
if [ ! -f /usr/bin/wget ]; then
case $ostype in
debian|ubuntu)
apt-get update -yqq
apt-get install -yqq wget
;;
rhel)
yum install -y -q wget
;;
esac
if [ "$?" -ne '0' ]; then
echo "Error: Can't install wget" >&2
exit 1
fi
fi
# Select script type
case $ostype in
debian|ubuntu) type='debian' ;;
rhel) type='rhel' ;;
esac
wget https://wind4.github.io/vlmcsd/scripts/install-$type.sh -O vlmcsd-$type.sh
if [ "$?" -eq '0' ]; then
bash vlmcsd-$type.sh $*
exit
else
echo 'Download installer failed.' >&2
exit 1
fi