diff --git a/.gitignore b/.gitignore index 3c4d992b7..d84844cb6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ exo manpage contrib cli +*.snap +*.xdelta3 diff --git a/cmd/root.go b/cmd/root.go index e47383c65..376baa4c6 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -203,6 +203,11 @@ func initConfig() { gConfigFolder = path.Join(usr.HomeDir, ".config", "exoscale") } + // Snap packages use $HOME/.exoscale (as negotiated with the snap store) + if _, snap := os.LookupEnv("SNAP_USER_COMMON"); snap { + gConfigFolder = path.Join(usr.HomeDir, ".exoscale") + } + if gConfigFilePath != "" { // Use config file from the flag. viper.SetConfigFile(gConfigFilePath) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 000000000..f69b28b05 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,45 @@ +name: exoscale-cli +base: core18 +version: git +summary: The Exoscale command line tool +description: | + The Exoscale command line tool. + + This snap allows you to use the "exo" command once installed, your + gateway to the Exoscale platform. + + Usage: sudo snap install exoscale-cli; exo config; exo vm list + +grade: stable # must be 'stable' to release into candidate/stable channels +confinement: strict # use 'strict' once you have the right plugs and slots + +plugs: + # This allows us to read/write in $HOME/.exoscale/* + # It was granted via a forum post and is autoconnected. + # Do not change the plug name. + dot-exoscale: + interface: personal-files + write: + - $HOME/.exoscale + +apps: + # The app has an alias to "exo" that was granted via forum post. + exoscale-cli: + command: exo + plugs: + - network + - home + - dot-exoscale + +parts: + exo: + # See 'snapcraft plugins' + disable-parallel: True + plugin: make + source: . + artifacts: + - exo + build-snaps: + - go + build-packages: + - git