From: Sebastien Douheret Date: Mon, 11 Dec 2017 10:05:55 +0000 (+0100) Subject: Standardized XDS config file name and location. X-Git-Tag: v1.0.0-rc2~5 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fxds%2Fxds-agent.git;a=commitdiff_plain;h=57bdfc8349b3c8a727d6f439e1fd12661bc00a15 Standardized XDS config file name and location. - config file name is : agent-config.json - xds-agent settings under user's home is: $HOME/.xds/agent - xds-agent settings under etc is: /etc/xds/agent Signed-off-by: Sebastien Douheret --- diff --git a/Makefile b/Makefile index 1d5c909..898b552 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,7 @@ package: clean tools/syncthing vendor build ifneq ($(GOOS), windows) @cp -r $(ROOT_SRCDIR)/conf.d $(ROOT_SRCDIR)/scripts $(PACKAGE_DIR)/$(TARGET)/ endif - @cp $(ROOT_SRCDIR)/conf.d/etc/xds-agent/agent-config.json $(PACKAGE_DIR)/$(TARGET)/agent-config.json.in + @cp $(ROOT_SRCDIR)/conf.d/etc/xds/agent/agent-config.json $(PACKAGE_DIR)/$(TARGET)/agent-config.json.in @cd $(PACKAGE_DIR) && zip -r $(ROOT_SRCDIR)/$(PACKAGE_ZIPFILE) ./$(TARGET) @echo "### Package $(PACKAGE_ZIPFILE) has been successfuly built - $(BUILD_MODE)" diff --git a/conf.d/etc/xds-agent/agent-config.json b/conf.d/etc/xds/agent/agent-config.json similarity index 100% rename from conf.d/etc/xds-agent/agent-config.json rename to conf.d/etc/xds/agent/agent-config.json diff --git a/conf.d/usr/lib/systemd/user/xds-agent.service b/conf.d/usr/lib/systemd/user/xds-agent.service index 1fd038b..6db084d 100644 --- a/conf.d/usr/lib/systemd/user/xds-agent.service +++ b/conf.d/usr/lib/systemd/user/xds-agent.service @@ -3,7 +3,7 @@ Description=XDS Agent [Service] EnvironmentFile=-/etc/default/xds-agent -ExecStart=/opt/AGL/xds/agent/xds-agent & +ExecStart=/opt/AGL/xds/agent/xds-agent [Install] WantedBy=multi-user.target diff --git a/lib/agent/agent.go b/lib/agent/agent.go index 58a2ba0..a562e77 100644 --- a/lib/agent/agent.go +++ b/lib/agent/agent.go @@ -132,7 +132,7 @@ func (ctx *Context) Run() (int, error) { ctx._logPrint("Logging file for HTTP requests: %s\n", logFileHTTPReq) } - // Create syncthing instance when section "syncthing" is present in config.json + // Create syncthing instance when section "syncthing" is present in agent-config.json if ctx.Config.FileConf.SThgConf != nil { ctx.SThg = st.NewSyncThing(ctx.Config, ctx.Log) } diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go index ac1e99d..c4b72c5 100644 --- a/lib/syncthing/st.go +++ b/lib/syncthing/st.go @@ -278,7 +278,7 @@ func (s *SyncThing) Start() (*exec.Cmd, error) { */ s.STCmd, err = s.startProc("syncthing", args, env, &s.exitSTChan) - // Use autogenerated apikey if not set by config.json + // Use autogenerated apikey if not set by agent-config.json if err == nil && s.APIKey == "" { if fd, err := os.Open(filepath.Join(s.Home, "config.xml")); err == nil { defer fd.Close() diff --git a/lib/xdsconfig/configfile.go b/lib/xdsconfig/configfile.go index 71870d0..c252073 100644 --- a/lib/xdsconfig/configfile.go +++ b/lib/xdsconfig/configfile.go @@ -55,7 +55,7 @@ type FileConfig struct { // Order to determine which config file is used: // 1/ from command line option: "--config myConfig.json" // 2/ $HOME/.xds/agent/agent-config.json file -// 3/ /etc/xds-agent/config.json file +// 3/ /etc/xds/agent/agent-config.json file func readGlobalConfig(c *Config, confFile string) error { @@ -67,7 +67,7 @@ func readGlobalConfig(c *Config, confFile string) error { searchIn = append(searchIn, path.Join(homeDir, ".xds", "agent", "agent-config.json")) } - searchIn = append(searchIn, "/etc/xds-agent/agent-config.json") + searchIn = append(searchIn, "/etc/xds/agent/agent-config.json") var cFile *string for _, p := range searchIn { diff --git a/scripts/install.sh b/scripts/install.sh index 10fc59f..444dc1b 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -28,7 +28,7 @@ install() { mkdir -p "${DESTDIR}" && cp "${ROOT_SRCDIR}/bin/*" "${DESTDIR}" || exit 1 mkdir -p "${DESTDIR_WWW}" && cp -a "${ROOT_SRCDIR}/webapp/dist/*" "${DESTDIR_WWW}" || exit 1 - cp "${ROOT_SRCDIR}/conf.d/etc/xds-agent" /etc/ || exit 1 + cp -a "${ROOT_SRCDIR}/conf.d/etc/xds" /etc/ || exit 1 cp "${ROOT_SRCDIR}/conf.d/etc/default/xds-agent" /etc/default/ || exit 1 FILE=/etc/profile.d/xds-agent.sh