// Package the deploy folder for clients
Package the deploy folder for clients
// Package the deploy folder for clients
func PackageFiles(configFile string) error {
	var c *SSHrimp
	_, err := toml.DecodeFile(configFile, &c)
	if err != nil {
		return err
	}
	winConfig := SSHrimp{}
	unixConfig := SSHrimp{}
	copier.Copy(&winConfig, &c)
	copier.Copy(&unixConfig, &c)
	var socketSplit []string
	if len(c.Agent.Socket) > 9 && c.Agent.Socket[0:9] == "\\\\.\\pipe\\" {
		socketSplit = strings.Split(c.Agent.Socket, "\\")
		unixConfig.Agent.Socket = "/tmp/" + socketSplit[len(socketSplit)-1] + ".sock"
	} else {
		socketSplit = strings.Split(c.Agent.Socket, "/")
		winConfig.Agent.Socket = "\\\\\\\\.\\\\pipe\\\\" + socketSplit[len(socketSplit)-1]
	}
	err = createOutputConfigFile("./deploy/windows/sshrimp-windows.toml", winConfig)
	if err != nil {
		return err
	}
	err = createOutputConfigFile("./deploy/mac/sshrimp-mac.toml", unixConfig)
	if err != nil {
		return err
	}
	err = createOutputConfigFile("./deploy/linux/sshrimp-linux.toml", unixConfig)
	if err != nil {
		return err
	}
	z := archiver.Zip{
		CompressionLevel:       flate.DefaultCompression,
		MkdirAll:               true,
		SelectiveCompression:   true,
		ContinueOnError:        false,
		OverwriteExisting:      true,
		ImplicitTopLevelFolder: false,
	}
	return z.Archive([]string{"./deploy/windows", "./deploy/mac", "./deploy/linux"}, "./deploy.zip")
}
func PackageFiles ( configFile string ) error { var c * SSHrimp _ , err := toml . DecodeFile ( configFile , & c ) if err != nil { return err } winConfig := SSHrimp { } unixConfig := SSHrimp { } copier . Copy ( & winConfig , & c ) copier . Copy ( & unixConfig , & c ) var socketSplit [ ] string if len ( c . Agent . Socket ) > 9 && c . Agent . Socket [ 0 : 9 ] == " \\ \\ \\ \\ " { socketSplit = strings . Split ( c . Agent . Socket , " \\ " ) unixConfig . Agent . Socket = " " + socketSplit [ len ( socketSplit ) - 1 ] + " " } else { socketSplit = strings . Split ( c . Agent . Socket , " " ) winConfig . Agent . Socket = " \\ \\ \\ \\ \\ \\ \\ \\ " + socketSplit [ len ( socketSplit ) - 1 ] } err = createOutputConfigFile ( " " , winConfig ) if err != nil { return err } err = createOutputConfigFile ( " " , unixConfig ) if err != nil { return err } err = createOutputConfigFile ( " " , unixConfig ) if err != nil { return err } z := archiver . Zip { CompressionLevel : flate . DefaultCompression , MkdirAll : true , SelectiveCompression : true , ContinueOnError : false , OverwriteExisting : true , ImplicitTopLevelFolder : false , } return z . Archive ( [ ] string { " " , " " , " " } , " " ) }
Package the deploy folder for clients
Package the deploy folder for clients
//read in config file // create new configs // deep clone configs from original // update the socket field in each config // Create the config files for each platform // Instantiate the archiver, ensuring overwrite is enabled