| ... | 
... | 
@@ -76,8 +76,17 @@ make_add_instruction() { | 
| 
76
 | 
76
 | 
     forced=
  | 
| 
77
 | 
77
 | 
   fi
  | 
| 
78
 | 
78
 | 
 
  | 
| 
79
 | 
 
 | 
-  verbose_notice "        add \"$f\"$forced"
  | 
| 
80
 | 
 
 | 
-  echo "add \"$f\"" >> "$filev3"
  | 
| 
 
 | 
79
 | 
+  is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/')
  | 
| 
 
 | 
80
 | 
+  if [ $is_extension = "1" ]; then
  | 
| 
 
 | 
81
 | 
+    # Use the subdirectory of the extensions folder as the file to test
  | 
| 
 
 | 
82
 | 
+    # before performing this add instruction.
  | 
| 
 
 | 
83
 | 
+    testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
  | 
| 
 
 | 
84
 | 
+    verbose_notice "     add-if \"$testdir\" \"$f\""
  | 
| 
 
 | 
85
 | 
+    echo "add-if \"$testdir\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
86
 | 
+  else
  | 
| 
 
 | 
87
 | 
+    verbose_notice "        add \"$f\"$forced"
  | 
| 
 
 | 
88
 | 
+    echo "add \"$f\"" >> "$filev3"
  | 
| 
 
 | 
89
 | 
+  fi
  | 
| 
81
 | 
90
 | 
 }
  | 
| 
82
 | 
91
 | 
 
  | 
| 
83
 | 
92
 | 
 check_for_add_if_not_update() {
 | 
| ... | 
... | 
@@ -106,8 +115,17 @@ make_patch_instruction() { | 
| 
106
 | 
115
 | 
   f="$1"
  | 
| 
107
 | 
116
 | 
   filev3="$2"
  | 
| 
108
 | 
117
 | 
 
  | 
| 
109
 | 
 
 | 
-  verbose_notice "      patch \"$f.patch\" \"$f\""
  | 
| 
110
 | 
 
 | 
-  echo "patch \"$f.patch\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
118
 | 
+  is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/')
  | 
| 
 
 | 
119
 | 
+  if [ $is_extension = "1" ]; then
  | 
| 
 
 | 
120
 | 
+    # Use the subdirectory of the extensions folder as the file to test
  | 
| 
 
 | 
121
 | 
+    # before performing this add instruction.
  | 
| 
 
 | 
122
 | 
+    testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
  | 
| 
 
 | 
123
 | 
+    verbose_notice "   patch-if \"$testdir\" \"$f.patch\" \"$f\""
  | 
| 
 
 | 
124
 | 
+    echo "patch-if \"$testdir\" \"$f.patch\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
125
 | 
+  else
  | 
| 
 
 | 
126
 | 
+    verbose_notice "      patch \"$f.patch\" \"$f\""
  | 
| 
 
 | 
127
 | 
+    echo "patch \"$f.patch\" \"$f\"" >> "$filev3"
  | 
| 
 
 | 
128
 | 
+  fi
  | 
| 
111
 | 
129
 | 
 }
  | 
| 
112
 | 
130
 | 
 
  | 
| 
113
 | 
131
 | 
 append_remove_instructions() {
 |