| ... | 
... | 
@@ -80,8 +80,17 @@ make_add_instruction() { | 
| 
80
 | 
80
 | 
     forced=
  | 
| 
81
 | 
81
 | 
   fi
  | 
| 
82
 | 
82
 | 
 
  | 
| 
83
 | 
 
 | 
-  verbose_notice "        add \"$f\"$forced"
  | 
| 
84
 | 
 
 | 
-  echo "add \"$f\"" >> "$filev3"
  | 
| 
 
 | 
83
 | 
+  is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/')
  | 
| 
 
 | 
84
 | 
+  if [ $is_extension = "1" ]; then
  | 
| 
 
 | 
85
 | 
+    # Use the subdirectory of the extensions folder as the file to test
  | 
| 
 
 | 
86
 | 
+    # before performing this add instruction.
  | 
| 
 
 | 
87
 | 
+    testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
  | 
| 
 
 | 
88
 | 
+    verbose_notice "     add-if \"$testdir\" \"$f\""
  | 
| 
 
 | 
89
 | 
+    echo "add-if \"$testdir\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
90
 | 
+  else
  | 
| 
 
 | 
91
 | 
+    verbose_notice "        add \"$f\"$forced"
  | 
| 
 
 | 
92
 | 
+    echo "add \"$f\"" >> "$filev3"
  | 
| 
 
 | 
93
 | 
+  fi
  | 
| 
85
 | 
94
 | 
 }
  | 
| 
86
 | 
95
 | 
 
  | 
| 
87
 | 
96
 | 
 check_for_add_if_not_update() {
 | 
| ... | 
... | 
@@ -141,8 +150,17 @@ make_patch_instruction() { | 
| 
141
 | 
150
 | 
   f="$1"
  | 
| 
142
 | 
151
 | 
   filev3="$2"
  | 
| 
143
 | 
152
 | 
 
  | 
| 
144
 | 
 
 | 
-  verbose_notice "      patch \"$f.patch\" \"$f\""
  | 
| 
145
 | 
 
 | 
-  echo "patch \"$f.patch\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
153
 | 
+  is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/')
  | 
| 
 
 | 
154
 | 
+  if [ $is_extension = "1" ]; then
  | 
| 
 
 | 
155
 | 
+    # Use the subdirectory of the extensions folder as the file to test
  | 
| 
 
 | 
156
 | 
+    # before performing this add instruction.
  | 
| 
 
 | 
157
 | 
+    testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
  | 
| 
 
 | 
158
 | 
+    verbose_notice "   patch-if \"$testdir\" \"$f.patch\" \"$f\""
  | 
| 
 
 | 
159
 | 
+    echo "patch-if \"$testdir\" \"$f.patch\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
160
 | 
+  else
  | 
| 
 
 | 
161
 | 
+    verbose_notice "      patch \"$f.patch\" \"$f\""
  | 
| 
 
 | 
162
 | 
+    echo "patch \"$f.patch\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
163
 | 
+  fi
  | 
| 
146
 | 
164
 | 
 }
  | 
| 
147
 | 
165
 | 
 
  | 
| 
148
 | 
166
 | 
 append_remove_instructions() {
 |