~snappy-dev/snappy/15.04

« back to all changes in this revision

Viewing changes to snappy/hwaccess.go

  • Committer: Snappy Tarmac
  • Author(s): John R. Lenton, Michael Vogt, Leo Arias, Launchpad Translations on behalf of snappy-dev, Federico Gimenez, Ricardo Mendoza
  • Date: 2015-10-13 06:03:57 UTC
  • mfrom: (711.1.54 snappy)
  • Revision ID: snappy_tarmac-20151013060357-rf1cz6y7190uzzlr
Merge trunk fixes. by snappy-dev approved by chipaca

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        "path/filepath"
30
30
        "strings"
31
31
 
 
32
        "launchpad.net/snappy/dirs"
32
33
        "launchpad.net/snappy/helpers"
33
34
)
34
35
 
43
44
 
44
45
// return the json filename to add to the security json
45
46
func getHWAccessJSONFile(snapname string) string {
46
 
        return filepath.Join(snapAppArmorDir, fmt.Sprintf("%s.json.additional", snapname))
 
47
        return filepath.Join(dirs.SnapAppArmorDir, fmt.Sprintf("%s.json.additional", snapname))
47
48
}
48
49
 
49
50
// Return true if the device string is a valid device
113
114
 
114
115
func udevRulesPathForPart(partid string) string {
115
116
        // use 70- here so that its read before the OEM rules
116
 
        return filepath.Join(snapUdevRulesDir, fmt.Sprintf("70-snappy_hwassign_%s.rules", partid))
 
117
        return filepath.Join(dirs.SnapUdevRulesDir, fmt.Sprintf("70-snappy_hwassign_%s.rules", partid))
117
118
}
118
119
 
119
120
func addUdevRuleForSnap(snapname, newRule string) error {
137
138
}
138
139
 
139
140
func writeUdevRuleForDeviceCgroup(snapname, device string) error {
140
 
        os.MkdirAll(snapUdevRulesDir, 0755)
 
141
        os.MkdirAll(dirs.SnapUdevRulesDir, 0755)
141
142
 
142
143
        // the device cgroup/launcher etc support only the apps level,
143
144
        // not a binary/service or version, so if we get a full
168
169
        }
169
170
 
170
171
        // check if there is anything apparmor related to add to
171
 
        globExpr := filepath.Join(snapAppArmorDir, fmt.Sprintf("%s_*.json", snapname))
 
172
        globExpr := filepath.Join(dirs.SnapAppArmorDir, fmt.Sprintf("%s_*.json", snapname))
172
173
        matches, err := filepath.Glob(globExpr)
173
174
        if err != nil {
174
175
                return err