]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/pakfire/lib/functions.sh
MPFire CGI korrigiert
[people/pmueller/ipfire-2.x.git] / src / pakfire / lib / functions.sh
CommitLineData
cde0e116 1#!/bin/bash
70df8302
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
cde0e116 21
c3bbdb21
MT
22. /etc/sysconfig/rc
23. $rc_functions
24
cde0e116
MT
25extract_files() {
26 echo "Extracting files..."
0b2ebeac 27 tar xvf /opt/pakfire/tmp/files --preserve --numeric-owner -C /
7d3af7f7 28 echo "...Finished."
cde0e116 29}
fe7fe395 30
c3bbdb21
MT
31remove_files() {
32 echo "Removing files..."
33 for i in $(cat /opt/pakfire/tmp/ROOTFILES); do
34 rm -rfv ${i}
35 done
fe7fe395
MT
36 echo "...Finished."
37}
38
39restart_service() {
40
41 /etc/init.d/$1 restart
42
43}
c3bbdb21
MT
44
45start_service() {
46 DELAY=0
47 while true
48 case "${1}" in
49 --delay|-d)
50 DELAY=${2}
51 shift 2
52 ;;
53 --background|-b)
54 BACKGROUND="&"
55 shift
56 ;;
57 -*)
58 log_failure_msg "Unknown Option: ${1}"
59 return 2 #invalid or excess argument(s)
60 ;;
61 *)
62 break
63 ;;
64 esac
65
66 [ -e "/etc/init.d/${1}" ] && \
67 (sleep ${DELAY} && /etc/init.d/${1} start ${BACKGROUND})
68}
69
70stop_service() {
71
72 [ -e "/etc/init.d/${1}" ] && /etc/init.d/${1} stop
73
74}