summaryrefslogtreecommitdiff
path: root/net-firewall/ufw/files/ufw-0.36.1-move-path.patch
blob: 8ace1edc11665cfae2506b09f739006b09d50c62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
--- a/doc/ufw-framework.8     2021-09-19 04:19:03.000000000 +0300
+++ b/doc/ufw-framework.8     2022-06-27 17:14:11.292890569 +0300
@@ -18,7 +18,7 @@
 parameters and configuration of IPv6. The framework consists of the following
 files:
 .TP
-#STATE_PREFIX#/ufw\-init
+#SHARE_DIR#/ufw\-init
 initialization script
 .TP
 #CONFIG_PREFIX#/ufw/before.init
@@ -47,7 +47,7 @@

 .SH "BOOT INITIALIZATION"
 .PP
-\fBufw\fR is started on boot with #STATE_PREFIX#/ufw\-init. This script is a
+\fBufw\fR is started on boot with #SHARE_DIR#/ufw\-init. This script is a
 standard SysV style initscript used by the \fBufw\fR command and should not be
 modified. The #CONFIG_PREFIX#/before.init and #CONFIG_PREFIX#/after.init
 scripts may be used to perform any additional firewall configuration that is
--- a/setup.py    2021-09-19 04:19:01.000000000 +0300
+++ b/setup.py    2022-06-27 17:33:18.043794598 +0300
@@ -54,7 +54,7 @@
             return

         real_confdir = os.path.join('/etc')
-        real_statedir = os.path.join('/lib', 'ufw')
+        real_statedir = os.path.join('/etc', 'ufw', 'user')
         real_prefix = self.prefix
         if self.home != None:
             real_confdir = self.home + real_confdir
@@ -131,14 +131,20 @@
         self.copy_file('doc/ufw.8', manpage)
         self.copy_file('doc/ufw-framework.8', manpage_f)

-        # Install state files and helper scripts
+        # Install state files
         statedir = real_statedir
         if self.root != None:
             statedir = self.root + real_statedir
         self.mkpath(statedir)

-        init_helper = os.path.join(statedir, 'ufw-init')
-        init_helper_functions = os.path.join(statedir, 'ufw-init-functions')
+        # Install helper scripts
+        sharedir = real_sharedir
+        if self.root != None:
+            sharedir = self.root + real_sharedir
+        self.mkpath(sharedir)
+
+        init_helper = os.path.join(sharedir, 'ufw-init')
+        init_helper_functions = os.path.join(sharedir, 'ufw-init-functions')
         self.copy_file('src/ufw-init', init_helper)
         self.copy_file('src/ufw-init-functions', init_helper_functions)

@@ -219,14 +225,19 @@
                              f])

             subprocess.call(["sed",
+                              "-i",
+                             "s%#SHARE_DIR#%" + real_sharedir + "%g",
+                             f])
+
+            subprocess.call(["sed",
                              "-i",
                              "s%#VERSION#%" + ufw_version + "%g",
                              f])

         # Install pristine copies of rules files
-        sharedir = real_sharedir
-        if self.root != None:
-            sharedir = self.root + real_sharedir
+        #sharedir = real_sharedir
+        #if self.root != None:
+        #    sharedir = self.root + real_sharedir
         rulesdir = os.path.join(sharedir, 'iptables')
         self.mkpath(rulesdir)
         for f in [ before_rules, after_rules, \
--- a/src/backend_iptables.py    2021-09-19 04:19:01.000000000 +0300
+++ b/src/backend_iptables.py    2022-06-27 17:44:24.880445896 +0300
@@ -37,6 +37,8 @@

         files = {}
         config_dir = _findpath(ufw.common.config_dir, datadir)
+        state_dir = _findpath(ufw.common.state_dir, datadir)
+        share_dir = _findpath(ufw.common.share_dir, datadir)

         files['rules'] = os.path.join(config_dir, 'ufw/user.rules')
         files['before_rules'] = os.path.join(config_dir, 'ufw/before.rules')
@@ -48,8 +50,7 @@
         # the lock files (ufw.common.state_dir, aka /lib/ufw), but when set,
         # ufw-init is in rootdir/lib/ufw (ro) and the lockfiles in
         # datadir/lib/ufw (rw)
-        files['init'] = os.path.join(_findpath(ufw.common.state_dir, rootdir),
-                                     'ufw-init')
+        files['init'] = os.path.join(share_dir, 'ufw-init')

         ufw.backend.UFWBackend.__init__(self, "iptables", dryrun, files,
                                         rootdir=rootdir, datadir=datadir)
--- a/src/ufw-init    2021-09-19 03:50:19.000000000 +0300
+++ b/src/ufw-init    2022-06-27 17:48:34.352545026 +0300
@@ -31,10 +31,10 @@
 fi
 export DATA_DIR="$datadir"

-if [ -s "${rootdir}#STATE_PREFIX#/ufw-init-functions" ]; then
-    . "${rootdir}#STATE_PREFIX#/ufw-init-functions"
+if [ -s "${rootdir}#SHARE_DIR#/ufw-init-functions" ]; then
+    . "${rootdir}#SHARE_DIR#/ufw-init-functions"
 else
-    echo "Could not find ${rootdir}#STATE_PREFIX#/ufw-init-functions (aborting)"
+    echo "Could not find ${rootdir}#SHARE_DIR#/ufw-init-functions (aborting)"
     exit 1
 fi

@@ -83,7 +83,7 @@
     fi
     ;;
 *)
-    echo "Usage: #STATE_PREFIX#/ufw-init {start|stop|restart|force-reload|force-stop|flush-all|status}"
+    echo "Usage: #SHARE_DIR#/ufw-init {start|stop|restart|force-reload|force-stop|flush-all|status}"
     exit 1
     ;;
 esac