@@ -81,11 +81,12 @@ func (tx *UsbGadgetTransaction) addFileChange(component string, change Requested
81
81
return key
82
82
}
83
83
84
- func (tx * UsbGadgetTransaction ) mkdirAll (component string , path string , description string ) string {
84
+ func (tx * UsbGadgetTransaction ) mkdirAll (component string , path string , description string , deps [] string ) string {
85
85
return tx .addFileChange (component , RequestedFileChange {
86
86
Path : path ,
87
87
ExpectedState : FileStateDirectory ,
88
88
Description : description ,
89
+ DependsOn : deps ,
89
90
})
90
91
}
91
92
@@ -131,14 +132,25 @@ func (tx *UsbGadgetTransaction) MountConfigFS() {
131
132
}
132
133
133
134
func (tx * UsbGadgetTransaction ) CreateConfigPath () {
134
- tx .mkdirAll ("gadget" , tx .configC1Path , "create config path" )
135
+ tx .mkdirAll (
136
+ "gadget" ,
137
+ tx .configC1Path ,
138
+ "create config path" ,
139
+ []string {configFSPath },
140
+ )
135
141
}
136
142
137
143
func (tx * UsbGadgetTransaction ) WriteGadgetConfig () {
138
144
// create kvm gadget path
139
- tx .mkdirAll ("gadget" , tx .kvmGadgetPath , "create kvm gadget path" )
145
+ tx .mkdirAll (
146
+ "gadget" ,
147
+ tx .kvmGadgetPath ,
148
+ "create kvm gadget path" ,
149
+ []string {tx .configC1Path },
150
+ )
140
151
141
152
deps := make ([]string , 0 )
153
+ deps = append (deps , tx .kvmGadgetPath )
142
154
143
155
for _ , val := range tx .orderedConfigItems {
144
156
key := val .key
@@ -188,7 +200,10 @@ func (tx *UsbGadgetTransaction) writeGadgetItemConfig(item gadgetConfigItem, dep
188
200
files = append (files , deps ... )
189
201
190
202
gadgetItemPath := joinPath (tx .kvmGadgetPath , item .path )
191
- files = append (files , tx .mkdirAll (component , gadgetItemPath , "create gadget item directory" ))
203
+ if gadgetItemPath != tx .kvmGadgetPath {
204
+ gadgetItemDir := tx .mkdirAll (component , gadgetItemPath , "create gadget item directory" , files )
205
+ files = append (files , gadgetItemDir )
206
+ }
192
207
193
208
beforeChange := make ([]string , 0 )
194
209
disableGadgetItemKey := fmt .Sprintf ("disable-%s" , item .device )
@@ -231,7 +246,10 @@ func (tx *UsbGadgetTransaction) writeGadgetItemConfig(item gadgetConfigItem, dep
231
246
// create config directory if configAttrs are set
232
247
if len (item .configAttrs ) > 0 {
233
248
configItemPath := joinPath (tx .configC1Path , item .configPath )
234
- tx .mkdirAll (component , configItemPath , "create config item directory" )
249
+ if configItemPath != tx .configC1Path {
250
+ configItemDir := tx .mkdirAll (component , configItemPath , "create config item directory" , files )
251
+ files = append (files , configItemDir )
252
+ }
235
253
files = append (files , tx .writeGadgetAttrs (
236
254
configItemPath ,
237
255
item .configAttrs ,
0 commit comments