]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/paks/vdr/install.sh
vdr: Convert netmask to CIDR notation on install.
[people/teissler/ipfire-2.x.git] / src / paks / vdr / install.sh
CommitLineData
b8013a57
MT
1#!/bin/bash
2############################################################################
3# #
4# This file is part of the IPFire Firewall. #
5# #
6# IPFire is free software; you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
8# the Free Software Foundation; either version 2 of the License, or #
9# (at your option) any later version. #
10# #
11# IPFire is distributed in the hope that it will be useful, #
12# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with IPFire; if not, write to the Free Software #
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
19# #
20# Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
21# #
22############################################################################
23#
24. /opt/pakfire/lib/functions.sh
25extract_files
26restore_backup ${NAME}
2cec0cef
MT
27
28# Automatically add the GREEN network to svdrphosts.conf
29(
9709b039 30 eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
2cec0cef 31
8e4c5bff
MT
32 GREEN_PREFIX=
33 case "${GREEN_NETMASK}" in
34 255.255.255.252)
35 GREEN_PREFIX=30
36 ;;
37 255.255.255.248)
38 GREEN_PREFIX=29
39 ;;
40 255.255.255.240)
41 GREEN_PREFIX=28
42 ;;
43 255.255.255.224)
44 GREEN_PREFIX=27
45 ;;
46 255.255.255.192)
47 GREEN_PREFIX=26
48 ;;
49 255.255.255.128)
50 GREEN_PREFIX=25
51 ;;
52 255.255.255.0)
53 GREEN_PREFIX=24
54 ;;
55 255.255.254.0)
56 GREEN_PREFIX=23
57 ;;
58 255.255.252.0)
59 GREEN_PREFIX=22
60 ;;
61 255.255.248.0)
62 GREEN_PREFIX=21
63 ;;
64 255.255.240.0)
65 GREEN_PREFIX=20
66 ;;
67 255.255.224.0)
68 GREEN_PREFIX=19
69 ;;
70 255.255.192.0)
71 GREEN_PREIFX=18
72 ;;
73 255.255.128.0)
74 GREEN_PREFIX=17
75 ;;
76 255.255.0.0)
77 GREEN_PREFIX=16
78 ;;
79 255.254.0.0)
80 GREEN_PREFIX=15
81 ;;
82 255.252.0.0)
83 GREEN_PREFIX=14
84 ;;
85 255.248.0.0)
86 GREEN_PREFIX=13
87 ;;
88 255.240.0.0)
89 GREEN_PREFIX=12
90 ;;
91 255.224.0.0)
92 GREEN_PREFIX=11
93 ;;
94 255.192.0.0)
95 GREEN_PREFIX=10
96 ;;
97 255.128.0.0)
98 GREEN_PREFIX=9
99 ;;
100 255.0.0.0)
101 GREEN_PREFIX=8
102 ;;
103 esac
104
105 if [ -n "${GREEN_NETADDRESS}" ] && [ -n "${GREEN_PREFIX}" ]; then
106 echo "${GREEN_NETADDRESS}/${GREEN_PREFIX}" >> /etc/vdr/svdrphosts.conf
2cec0cef
MT
107 fi
108) || :
109
b8013a57
MT
110start_service --background ${NAME}
111
112# Create video directory if it does not exist, yet.
113if [ ! -e "/var/video" ]; then
114 mkdir -p /var/video
115fi