Set the 755 permissions on the given script.
@param config - the instance config
@param scriptName - the name of the script (located in the bin directory) to make executable
343784
public static void setScriptPermission(InstanceConfiguration config, String scriptName)
    {
        if (SystemUtils.IS_OS_WINDOWS)
        {
            // we do not have file permissions on windows
            return;
        }
        if (VersionUtil.isEqualOrGreater_7_0_0(config.getClusterConfiguration().getVersion())) {
            // ES7 and above is packaged as a .tar.gz, and as such the permissions are preserved
            return;
        }
        
        CommandLine command = new CommandLine("chmod")
                .addArgument("755")
                .addArgument(String.format("bin/%s", scriptName));
        ProcessUtil.executeScript(config, command);

        command = new CommandLine("sed")
                .addArguments("-i''")
                .addArgument("-e")
                .addArgument("1s:.*:#!/usr/bin/env bash:", false)
                .addArgument(String.format("bin/%s", scriptName));
        ProcessUtil.executeScript(config, command);
    }
91815
protected void setPermissionStatus(PermissionStatus ps) {
    setUser(ps.getUserName());
    setGroup(ps.getGroupName());
    setPermission(ps.getPermission());
  }
478356
public void setPreTransScript( final String script) {
		setPreTransProgram(readProgram(script));
		if ( script != null) format.getHeader().createEntry( PRETRANSSCRIPT, script);
	}
1341280
public void setPreUninstallScript( final String script) {
        setPreUninstallProgram(readProgram(script));
        if ( script != null) format.getHeader().createEntry( PREUNSCRIPT, script);
	}
584399
function _runScript(config, options) {
  const useSandbox = ((isFunction(config.useSandbox)) ? _config.useSandbox(_config) || false : config.useSandbox);
  const module = new Module(config);
  const scopeParams = _getScopeParams(config, module, config.scope);
  const script = _createScript(config, options, config.scope);

  try {
    if (useSandbox) {
      script.runInContext(_createSandbox(config), options)(...scopeParams);
    } else {
      script.runInThisContext(options)(...scopeParams);
    }
  } catch(error) {
    if (config.squashErrors) cache.delete(options.filename);
    if (!config.squashErrors) {
      if (_runError(error, module)) throw error;
    } else {
      throw error;
    }
  }

  return module;
}
364796
@Override
    public SecurityConfig setClientPermissionConfigs(Set<PermissionConfig> permissions) {
        if (securityService == null) {
            throw new UnsupportedOperationException("Unsupported operation");
        }
        securityService.refreshClientPermissions(permissions);
        return this;
    }
1218156
@Override
  public Element setText(String script) {
    if (StringUtils.isEmpty(script)) {
      super.setText(script);
    }
    else {
      this.addContent(new Text("\n//"));

      // encapsulate script block in CDATA block
      this.addContent(new CDATA("\n"
          + script
          + "\n//"));

      this.addContent("\n");
    }
    return this;
  }
851586
function(auditRuleName, config) {
        if (!(auditRuleName in this.rules_))
            this.rules_[auditRuleName] = {};
        this.rules_[auditRuleName].config = config;
    }
1301921
public void changePermissions(String filename, String permissions)
			throws SftpStatusException, SshException {

		SftpFileAttributes attrs = new SftpFileAttributes(this,
				SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN);
		attrs.setPermissions(permissions);
		setAttributes(filename, attrs);

	}
1309555
public static void putScript(String name, KotlinCompiledScript script) {
        getInstance().scripts.put(name, script);
    }
332129
protected function applyPermissions(array $config) : void
    {
        $this->stdout("Init permissions: " . count($config) . "\n", Console::FG_YELLOW);
        foreach ($config as $item) {
            if ($permission = $this->applyPermission($item)) {
                $this->stdout("\t- success: " . $permission->name . "\n", Console::FG_GREEN);
            } else {
                $this->stdout("\t- error config permission: " . Json::encode($item) . "\n", Console::FG_RED);
            }
        }
    }
914305
private void configureScriptClassNode() {
        ClassNode scriptClassNode = moduleNode.getScriptClassDummy();

        if (!asBoolean(scriptClassNode)) {
            return;
        }

        List<Statement> statements = moduleNode.getStatementBlock().getStatements();
        if (!statements.isEmpty()) {
            Statement firstStatement = statements.get(0);
            Statement lastStatement = statements.get(statements.size() - 1);

            scriptClassNode.setSourcePosition(firstStatement);
            scriptClassNode.setLastColumnNumber(lastStatement.getLastColumnNumber());
            scriptClassNode.setLastLineNumber(lastStatement.getLastLineNumber());
        }

    }
996275
private static void setScriptVarImpl(String scriptName, String key, String value) {	
		validateKey(key);
		
		Map<String, String> scVars = scriptVars
				.computeIfAbsent(scriptName, k -> Collections.synchronizedMap(new HashMap<String, String>()));
		
		if (value == null) {
			scVars.remove(key);
		} else {
			validateValueLength(value);
			if (scVars.size() > MAX_SCRIPT_VARS) {
				throw new IllegalArgumentException("Maximum number of script variables reached: " + MAX_SCRIPT_VARS);
			}
			scVars.put(key, value);
		}
	}
1101150
public void setScriptFile(final String scriptFile) {
        this.scriptFile = scriptFile;
        this.scriptType = determineScriptType(scriptFile);
        if (scriptType != SCRIPT_TYPE.CONTENTS) {
            // assume that if adjusting the file, engine name should also be re-calc'd
            // if scriptType is CONTENTS then we can't determine engineName anyway
            this.engineName = getScriptEngineName(scriptFile);
        }
    }
198553
public void exec(final MainRemote.Script script) throws Exception {
        final File file = File.createTempFile("takes-", ".txt");
        if (!file.delete()) {
            throw new IOException(
                String.format(
                    // @checkstyle LineLength (1 line)
                    "The temporary file '%s' could not be deleted before calling the exec method",
                    file.getAbsolutePath()
                )
            );
        }
        final Method method = this.app.getDeclaredMethod(
            "main", String[].class
        );
        final String[] passed = new String[1 + this.args.length];
        passed[0] = String.format("--port=%s", file.getAbsoluteFile());
        for (int idx = 0; idx < this.args.length; ++idx) {
            passed[idx + 1] = this.args[idx];
        }
        final Thread thread = new Thread(new MainMethod(method, passed));
        thread.start();
        try {
            script.exec(
                URI.create(
                    String.format(
                        "http://localhost:%d",
                        MainRemote.port(file)
                    )
                )
            );
        } catch (final IOException ex) {
            if (!file.delete()) {
                ex.addSuppressed(
                    new IOException(
                        String.format(
                            // @checkstyle LineLength (1 line)
                            "The temporary file '%s' could not be deleted while catching the error",
                            file.getAbsolutePath()
                        )
                    )
                );
            }
            throw ex;
        } finally {
            thread.interrupt();
        }
        if (!file.delete()) {
            throw new IOException(
                String.format(
                    // @checkstyle LineLength (1 line)
                    "The temporary file '%s' could not be deleted after calling the exec method",
                    file.getAbsolutePath()
                )
            );
        }
    }
1362482
public static void setFessConfig(final FessConfig fessConfig) {
        ComponentUtil.fessConfig = fessConfig;
        if (fessConfig == null) {
            FessProp.propMap.clear();
            componentMap.clear();
        }
    }
1271466
public static void setScriptsExecutable(File dir) {
		String os = System.getProperty("os.name");
		if (os != null && !os.startsWith("Windows")) {
			FileFilter filter = FileUtils.getSuffixFileFilter(".sh");
			setExecutable(dir, filter);
		}
	}