]>
Commit | Line | Data |
---|---|---|
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 |
25 | extract_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 |
31 | remove_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 | ||
b8e5a9c5 | 39 | make_backup() { |
83d95bf1 MT |
40 | if [ -e "/var/ipfire/backup/addons/includes/${1}" ]; then |
41 | echo "Creating Backup..." | |
42 | /usr/local/bin/backupctrl addonbackup ${1} | |
43 | echo "...Finished." | |
30945c78 | 44 | fi |
5ad5a6bc MT |
45 | } |
46 | ||
b8e5a9c5 | 47 | restore_backup() { |
83d95bf1 MT |
48 | if [ -e "/var/ipfire/backup/addons/backup/${1}.ipf" ]; then |
49 | echo "Restoring Backup..." | |
50 | /usr/local/bin/backupctrl restoreaddon ${1}.ipf | |
51 | echo "...Finished." | |
30945c78 | 52 | fi |
5ad5a6bc MT |
53 | } |
54 | ||
fe7fe395 | 55 | restart_service() { |
30945c78 | 56 | /etc/init.d/${1} restart |
fe7fe395 | 57 | } |
c3bbdb21 MT |
58 | |
59 | start_service() { | |
60 | DELAY=0 | |
61 | while true | |
30945c78 | 62 | do |
c3bbdb21 MT |
63 | case "${1}" in |
64 | --delay|-d) | |
65 | DELAY=${2} | |
66 | shift 2 | |
67 | ;; | |
68 | --background|-b) | |
69 | BACKGROUND="&" | |
70 | shift | |
71 | ;; | |
72 | -*) | |
73 | log_failure_msg "Unknown Option: ${1}" | |
74 | return 2 #invalid or excess argument(s) | |
75 | ;; | |
76 | *) | |
77 | break | |
78 | ;; | |
79 | esac | |
30945c78 | 80 | done |
c3bbdb21 | 81 | |
83d95bf1 MT |
82 | if [ -e "/etc/init.d/${1}" ]; then |
83 | sleep ${DELAY} | |
84 | /etc/init.d/${1} start ${BACKGROUND} | |
85 | fi | |
c3bbdb21 MT |
86 | } |
87 | ||
88 | stop_service() { | |
83d95bf1 MT |
89 | if [ -e "/etc/init.d/${1}" ]; then |
90 | /etc/init.d/${1} stop | |
30945c78 | 91 | fi |
c3bbdb21 | 92 | } |