diff --git a/internal/provider/instance/bin.sh b/internal/provider/instance/bin.sh deleted file mode 100644 index e713095..0000000 --- a/internal/provider/instance/bin.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -. /etc/profile && cd [[.DATA_DIR]] && sh aemw "$@" diff --git a/internal/provider/instance/create.sh b/internal/provider/instance/create.sh index 266a3e6..4e591fe 100644 --- a/internal/provider/instance/create.sh +++ b/internal/provider/instance/create.sh @@ -1,3 +1,4 @@ #!/bin/sh -sh aemw instance create +sh aemw instance create && \ +sh aemw instance init diff --git a/internal/provider/instance/embed.go b/internal/provider/instance/embed.go index 69cdc37..8dde733 100644 --- a/internal/provider/instance/embed.go +++ b/internal/provider/instance/embed.go @@ -8,9 +8,6 @@ var ConfigYML string //go:embed systemd.conf var ServiceConf string -//go:embed bin.sh -var BinScript string - //go:embed create.sh var CreateScript string diff --git a/internal/provider/instance_client.go b/internal/provider/instance_client.go index 0b1ec8c..56455ff 100644 --- a/internal/provider/instance_client.go +++ b/internal/provider/instance_client.go @@ -99,7 +99,6 @@ func (ic *InstanceClient) saveProfileScript() error { } func (ic *InstanceClient) configureService() error { - binFile := fmt.Sprintf("/usr/sbin/%s", ServiceName) user := ic.data.System.User.ValueString() if user == "" { user = ic.cl.Connection().User() @@ -107,23 +106,11 @@ func (ic *InstanceClient) configureService() error { vars := map[string]string{ "DATA_DIR": ic.dataDir(), "USER": user, - "BIN_FILE": binFile, } ic.cl.Sudo = true defer func() { ic.cl.Sudo = false }() - binScriptTemplated, err := utils.TemplateString(ic.data.System.BinScript.ValueString(), vars) - if err != nil { - return fmt.Errorf("unable to template AEM system script: %w", err) - } - if err := ic.cl.FileWrite(binFile, binScriptTemplated); err != nil { - return fmt.Errorf("unable to write AEM system script '%s': %w", binFile, err) - } - if err := ic.cl.FileMakeExecutable(binFile); err != nil { - return fmt.Errorf("unable to make AEM system script '%s' executable: %w", binFile, err) - } - serviceTemplated, err := utils.TemplateString(ic.data.System.ServiceConfig.ValueString(), vars) if err != nil { return fmt.Errorf("unable to template AEM system service definition: %w", err) diff --git a/internal/provider/instance_resource.go b/internal/provider/instance_resource.go index a13fef1..9dfdf90 100644 --- a/internal/provider/instance_resource.go +++ b/internal/provider/instance_resource.go @@ -44,7 +44,6 @@ type InstanceResourceModel struct { DataDir types.String `tfsdk:"data_dir"` WorkDir types.String `tfsdk:"work_dir"` Env types.Map `tfsdk:"env"` - BinScript types.String `tfsdk:"bin_script"` ServiceConfig types.String `tfsdk:"service_config"` User types.String `tfsdk:"user"` Bootstrap types.String `tfsdk:"bootstrap"` @@ -117,12 +116,6 @@ func (r *InstanceResource) Schema(ctx context.Context, req resource.SchemaReques Optional: true, Default: stringdefault.StaticString("/tmp/aemc"), }, - "bin_script": schema.StringAttribute{ - MarkdownDescription: "Contents of the system-wide binary script for controlling AEM instance.", - Optional: true, - Computed: true, - Default: stringdefault.StaticString(instance.BinScript), - }, "service_config": schema.StringAttribute{ MarkdownDescription: "Contents of the AEM 'systemd' service definition file", Optional: true,