Initial commit
This commit is contained in:
20
LICENSE
Normal file
20
LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2022 Sergei Fedosoff <eleksir@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
5
README
Normal file
5
README
Normal file
@@ -0,0 +1,5 @@
|
||||
Slackware-service is a wrapper script that tries to mimic redhat "service" command.
|
||||
|
||||
When you call "service something start" (for example) it simply runs "/etc/rc.d/rc.something start", thats it.
|
||||
Since I spent many hours with redhat/rhel/rhel-based systems I stick with command called "service", and find it much
|
||||
easier to use this kind of script instead forcing my habbit to change.
|
||||
19
slack-desc
Normal file
19
slack-desc
Normal file
@@ -0,0 +1,19 @@
|
||||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||
# up the first '|' above the ':' following the base package name, and the '|'
|
||||
# on the right side marks the last column you can put a character in. You must
|
||||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':'.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
slackware-service: slackware-service (redhat-like service command wrapper)
|
||||
slackware-service:
|
||||
slackware-service: slackware-service privides "service" command like in old fashion
|
||||
slackware-service: redhat-like distibutions. It allows to run slackware services from
|
||||
slackware-service: /etc/rc.d dir like redhat ones - service service name action
|
||||
slackware-service:
|
||||
slackware-service:
|
||||
slackware-service:
|
||||
slackware-service:
|
||||
slackware-service:
|
||||
slackware-service:
|
||||
46
slackware-service.Slackbuild
Executable file
46
slackware-service.Slackbuild
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Copyright (c) 2022 Sergei Fedosoff <eleksir@gmail.com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
PRGNAM=slackware-service
|
||||
VERSION=${VERSION:-1.0}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_EXs}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
mkdir -p "$PKG"
|
||||
|
||||
if [ ! -d "$OUTPUT" ]; then
|
||||
mkdir -p "$OUTPUT"
|
||||
fi
|
||||
|
||||
install -Dpm 0744 src/service "${PKG}/usr/sbin/service"
|
||||
install -Dpm 0644 LICENSE "${PKG}/usr/doc/${PRGNAM}-${VERSION}/LICENSE"
|
||||
install -Dpm 0644 slack-desc "${PKG}/install/slack-desc"
|
||||
|
||||
cd "${PKG}"
|
||||
/sbin/makepkg -l y -c n "${OUTPUT}/${PRGNAM}-${VERSION}-noarch-${BUILD}${TAG}.${PKGTYPE}"
|
||||
46
src/service
Normal file
46
src/service
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
function help() {
|
||||
echo "Usage: $0 service_name command"
|
||||
}
|
||||
|
||||
|
||||
if [[ $1 == '' ]]; then
|
||||
echo "Service_name is required!"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $1 == '--help' ]]; then
|
||||
help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $1 == '-h' ]]; then
|
||||
help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $2 == '' ]]; then
|
||||
echo "Command is required!"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -e /etc/rc.d/rc.$1 ]]; then
|
||||
:
|
||||
else
|
||||
echo "/etc/rc.d/rc.$1 does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -x /etc/rc.d/rc.$1 ]]; then
|
||||
:
|
||||
else
|
||||
echo "Bit +x is not set on /etc/rc.d/rc.$1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CMD=$1
|
||||
shift 1
|
||||
exec "/etc/rc.d/rc.$CMD" "$@"
|
||||
Reference in New Issue
Block a user