From 20df85bb4a97cb07b922021c64d63edf01875f71 Mon Sep 17 00:00:00 2001 From: Benedikt Boehm Date: Wed, 20 Dec 2006 12:33:59 +0000 Subject: everything is in upstream now, no more patch tarballs, yay svn path=/; revision=533 --- util-vserver/tools/gentoo-functions.sh | 150 --------------------------------- 1 file changed, 150 deletions(-) delete mode 100644 util-vserver/tools/gentoo-functions.sh (limited to 'util-vserver/tools/gentoo-functions.sh') diff --git a/util-vserver/tools/gentoo-functions.sh b/util-vserver/tools/gentoo-functions.sh deleted file mode 100644 index 9cdf45d..0000000 --- a/util-vserver/tools/gentoo-functions.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash -# -# gentoo-functions.sh - shared functions util-vserver on gentoo -# Copyright (C) 2005 Benedikt Boehm -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -if [ ! -e /sbin/functions.sh ]; then - echo "/sbin/functions.sh missing. Are you running Gentoo?" - exit 1 -fi - -[ -z "${RC_GOT_FUNCTIONS}" ] && source /sbin/functions.sh - -die() { - eerror ${1:-} - einfo "Type ${APP} --help for details" - - exit ${2:-1} -} - -vs_list_proc() { - find /proc/virtual/ -noleaf -mindepth 1 -maxdepth 1 -type d -exec basename {} \; -} - -vs_is_running_xid() { -# $1 - xid - [ -z "$1" ] && return 1 - [ -d /proc/virtual/${1} ] -} - -vs_is_running_name() { -# $1 - name -# $2 - do not trust util-vserver - [ -z "$1" ] && return 1 - - if [ -n "$2" ]; then - for name in $(vs_running_name true); do - [ "${name}" == "$1" ] && return 0 - done - return 1 - else - [ -d /var/run/vservers/${1} ] - return $? - fi -} - -vs_running_xid() { -# $1 - do not trust util-vserver - if [ -n "$1" ]; then - vs_list_proc - else - ls /var/run/vservers.rev - fi -} - -vs_running_name() { -# $1 - do not trust util-vserver - if [ -n "$1" ]; then - for xid in $(vs_list_proc); do - vs_xid2name ${xid} true - done - else - ls /var/run/vservers - fi -} - -vs_xid2name() { -# $1 - xid -# $2 - do not trust util-vserver - if [ -n "$2" ]; then - basename $(vuname -g --xid ${1} CONTEXT) - else - basename $(readlink /var/run/vservers.rev/${1}) - fi -} - -vs_name2xid() { -# $1 - name -# $2 - do not trust util-vserver - if [ -n "$2" ]; then - for xid in $(vs_list_proc); do - if [ "$(vs_xid2name ${xid} true)" == "$1" ]; then - echo ${xid} - break; - fi - done - else - cat /var/run/vservers/${1} - fi -} - -unpack() { - local x - local y - local myfail - local tarvars - - [ -z "$*" ] && die "Nothing passed to the 'unpack' command" - - for x in "$@"; do - myfail="unpacking ${x} failed" - y="${x%.*}" - y="${y##*.}" - - case "${x##*.}" in - tar) - tar xf "${DISTDIR}/${x}" ${tarvars} || die "$myfail" - ;; - tgz) - tar xzf "${DISTDIR}/${x}" ${tarvars} || die "$myfail" - ;; - tbz2) - bzip2 -dc "${DISTDIR}/${x}" | tar xf - ${tarvars} || die "$myfail" - ;; - ZIP|zip) - unzip -qo "${DISTDIR}/${x}" || die "$myfail" - ;; - gz|Z|z) - if [ "${y}" == "tar" ]; then - tar xzf "${DISTDIR}/${x}" ${tarvars} || die "$myfail" - else - gzip -dc "${DISTDIR}/${x}" > ${x%.*} || die "$myfail" - fi - ;; - bz2) - if [ "${y}" == "tar" ]; then - bzip2 -dc "${DISTDIR}/${x}" | tar xf - ${tarvars} || die "$myfail" - else - bzip2 -dc "${DISTDIR}/${x}" > ${x%.*} || die "$myfail" - fi - ;; - *) - die "unpack ${x}: file format not recognized." - ;; - esac - done -} -- cgit v1.2.3-65-gdbad