add app-misc/screenservice, change README

This commit is contained in:
Jörg Deckert 2013-11-13 16:57:41 +01:00
parent 3d3efe9f20
commit fbe36dc438
5 changed files with 114 additions and 0 deletions

2
README
View File

@ -4,6 +4,8 @@ es wird keinerlei Garantie für die Fehlerfreiheit übernommen.
Die Installation erfolgt z.B. mittels:
# emerge -av layman
# cd /etc/layman/overlays
# wget https://office.unitas-network.de/gitblit/raw/gentoo%2Funitas.git/HEAD/unitas-overlays.xml
# layman -L
# layman -a unitas

View File

@ -0,0 +1,3 @@
AUX screen-adm 146 SHA256 ff4eff5396b872d9a368597db6c2a4806ef234f95ded6894a1556c22b341462e SHA512 5d9a23c79602f0cee5b41f6e7ea5842ff50fe16d5a5847474772ebdbd422927aa6dab7ff5890f8bd932a44c5fca1960f43dd88128836787b68142d6e88585659 WHIRLPOOL 7d4948e04883d6b251a2134b190c7fcbad3a6efdd9717a09b718ce2e97d5949b3380b240e542d31554aad4c6239fa68ec4995259eb23cccc8d10a3045ffdaf56
AUX screen.init 2319 SHA256 6b48f64cb79b59088736e1aaebfb8eef410b53089ebe1886b9aca0ff3825718a SHA512 dffd05b6b5352c88416918113a9b66681ee31166ab6783408daf74636dcab9e77142800d43d3ffa022be2082c1c0e97807901d9782a9da9d67c94b3c24d16a2a WHIRLPOOL 375adc5ff690e4a11f11b15f7ea6f7b4574e2c21b6397a1f16e474fa7ec9e1fa530cbb75b91bf30d3747847556276868452d34080f88ea539e38ab178788cbcd
EBUILD screenservice-1.1.ebuild 580 SHA256 8cbf454ede26ee065d3591204dddc30cbea68bf29767e913395065f0f8139d2f SHA512 6317fc171a20ea8209658024b50b578720113cc0faeb65c00cea586d7d4662acf98b0fd083c391eb1b98a6a462ac17f8c123567f0f897d78431a1ee55f2b1ea4 WHIRLPOOL fef8ad56df7a79853bfe7c4724787c5a2ea8ac4dc9494f116a68bf6c9df7670d92823d70988cfa0d5ff2912287295c3d6b4b57357c0cd404ff51026d58f8e61d

View File

@ -0,0 +1,3 @@
caption always "%{rw} * %H * | $LOGNAME | %{bw}%c %D | %{-}%-Lw%{rw}%50>%{rW}%n%f* %t %{-}%+Lw%<"
screen -t SHELL 0
screen -t MC 1 /usr/bin/mc

View File

@ -0,0 +1,89 @@
#!/sbin/runscript
# Ilya Dmitrichenko < errordeveloper - at -at- g m a i l -dot- com
# Distributed under the terms of the GNU General Public License v2
# Originally written for Gentoo, but should work on other platforms :)
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4
depend() {
use net debug
}
start() {
## SVCNAME is the name of this file in /etc/init.d/
## so one can creat /etc/extra-screens.d/ and put
## the screenrc files there, then simlink the files
## /etc/init.d/screen -> /etc/init.d/extra-screens
for SCREENRC in /etc/${SVCNAME}.d/* ; do
SESSION="$(basename $SCREENRC)"
## I don't think there may be a security issue,
## provided that users will not be have write
## permission in /etc/screen.d/ and if anyone
## gained access to mod the session file, they
## are in already anyhow!
BELONGS="$(stat $SCREENRC --printf=%U)"
MYSHELL="$(getent passwd $BELONGS | cut -d: -f7)"
COMMAND="/usr/bin/screen -- -U -D -m -c ${SCREENRC} -S ${SESSION} -t ${SESSION}"
## Why on earth would one write this ???
#HOMEDIR="$(getent passwd $BELONGS | cut -d: -f6)"
ebegin "Starting ${SVCNAME} session ${SESSION} for ${BELONGS}"
PIDFILE="/var/run/${SVCNAME}.${BELONGS}.${SESSION}.pid"
start-stop-daemon \
--env TERM="rxvt" \
--env HOME="~${BELONGS}" \
--env SHELL="${MYSHELL}" \
--env SCREEN_SESSION=${SESSION} \
--user $BELONGS \
--chdir "~${BELONGS}" \
--make-pidfile \
--background \
--pidfile=${PIDFILE} \
--exec ${COMMAND}
eend $?
done
#screen -li || /bin/true
}
stop() {
## Perhaps we should determin this by pidfiles ...
## but this way is not bad either!
for SCREENRC in /etc/${SVCNAME}.d/* ; do
SESSION="$(basename $SCREENRC)"
BELONGS="$(stat $SCREENRC --printf=%U)"
PIDFILE="/var/run/${SVCNAME}.${BELONGS}.${SESSION}.pid"
PROCESS="$(cat ${PIDFILE})"
if [ -e /proc/${PROCESS}/status ]; then
grep -i "Name:" /proc/${PROCESS}/status | grep -iq "screen" || continue
ebegin "Stopping ${SVCNAME} session ${SESSION} for ${BELONGS} (PID: ${PROCESS})"
## It will CERTAINly kill the righ screen!
CERTAIN="${PROCESS}.${SESSION}"
env TERM="urxvt" \
start-stop-daemon \
--user ${BELONGS} \
--exec /usr/bin/screen -- -S $CERTAIN -X quit
eend $?
fi
rm -f $PIDFILE
done
}

View File

@ -0,0 +1,17 @@
EAPI="4"
DESCRIPTION="Start Screen sessions as a service"
HOMEPAGE="https://bugs.gentoo.org/show_bug.cgi?id=381451"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 sparc-fbsd x86-fbsd hppa-hpux amd64-linux x86-linux ppc-macos x64-macos x86-macos sparc-solaris sparc64-solaris x64-solaris x86-solaris"
RDEPEND="app-misc/screen
app-misc/mc[-slang]"
DEPEND="${RDEPEND}"
S=${WORKDIR}
src_install() {
newinitd "${FILESDIR}/screen.init" screen || die
insinto /etc/screen.d
newins "${FILESDIR}/screen-adm" screen-adm
}