Declares a script to be run as part of the RPM pre-installation. The
script will be run using the interpreter declared with the
{@link #setPreInstallProgram(String)} method.

@param script Script contents to run (i.e. shell commands)
346010
public void setPreInstallScript( final String script) {
        setPreInstallProgram(readProgram(script));
        if ( script != null) format.getHeader().createEntry( PREINSCRIPT, script);
	}
537181
public function prepare(Script $script)
    {
        $script->addCustomScriptLabel(ScriptLabel::MouseClick, $this->getScriptMouseClick());
        if ($this->action !== null) {
            $script->addCustomScriptLabel(ScriptLabel::EntrySubmit, $this->getScriptEntrySubmit());
        }
    }
200345
public void setPostUninstallScript( final String script) {
        setPostUninstallProgram(readProgram(script));
        if ( script != null) format.getHeader().createEntry( POSTUNSCRIPT, script);
	}
221155
public void setPostInstallProgram( final String program) {
		if ( null == program) {
			format.getHeader().createEntry( POSTINPROG, DEFAULTSCRIPTPROG);
		} else if ( 0 == program.length()){
			format.getHeader().createEntry( POSTINPROG, DEFAULTSCRIPTPROG);
		} else {
			format.getHeader().createEntry( POSTINPROG, program);
		}
	}
941456
@Override
    public RPMBuilder setPostUnInstallation(String script, String interpreter)
    {
        addString(RPMTAG_POSTUN, script);
        addString(RPMTAG_POSTUNPROG, interpreter);
        ensureBinSh();
        return this;
    }
1004870
private void runScript(String alias, int levelC) throws IOException {
		String scriptFile = alias;
		InputStream stream;
		try {
			stream = getInputStream(scriptFile);
			if (stream == null) {
				System.out.println("Error.  Script file is not found: " + scriptFile);
				return;
			}
		} catch (IOException e) {
			System.out.println("Error.  Could not load script file " + scriptFile + ": " + e.getMessage());
			return;
		}
		final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
		try {
			doLines(levelC + 1, new LineReader() {
				@Override
				public String getNextLine(String prompt) throws IOException {
					return reader.readLine();
				}
			}, true);
		} finally {
			reader.close();
		}
	}
357827
public void eInit(SarlScript script, String name, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlAnnotationType == null) {
			this.container = script;
			this.sarlAnnotationType = SarlFactory.eINSTANCE.createSarlAnnotationType();
			script.getXtendTypes().add(this.sarlAnnotationType);
			this.sarlAnnotationType.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration());
			if (!Strings.isEmpty(name)) {
				this.sarlAnnotationType.setName(name);
			}
		}
	}
335997
public Object run(final File scriptFile, String[] args) throws CompilationFailedException, IOException {
        String scriptName = scriptFile.getName();
        int p = scriptName.lastIndexOf(".");
        if (p++ >= 0) {
            if (scriptName.substring(p).equals("java")) {
                throw new CompilationFailedException(0, null);
            }
        }

        // Get the current context classloader and save it on the stack
        final Thread thread = Thread.currentThread();
        //ClassLoader currentClassLoader = thread.getContextClassLoader();

        class DoSetContext implements PrivilegedAction {
            ClassLoader classLoader;

            public DoSetContext(ClassLoader loader) {
                classLoader = loader;
            }

            public Object run() {
                thread.setContextClassLoader(classLoader);
                return null;
            }
        }

        AccessController.doPrivileged(new DoSetContext(loader));

        // Parse the script, generate the class, and invoke the main method.  This is a little looser than
        // if you are compiling the script because the JVM isn't executing the main method.
        Class scriptClass;
        try {
            scriptClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Class>() {
                public Class run() throws CompilationFailedException, IOException {
                    return loader.parseClass(scriptFile);
                }
            });
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if (e instanceof CompilationFailedException) {
                throw (CompilationFailedException) e;
            } else if (e instanceof IOException) {
                throw (IOException) e;
            } else {
                throw (RuntimeException) pae.getException();
            }
        }

        return runScriptOrMainOrTestOrRunnable(scriptClass, args);

        // Set the context classloader back to what it was.
        //AccessController.doPrivileged(new DoSetContext(currentClassLoader));
    }
629883
public static CompiledScript compile(ScriptEngine engine, String script) throws ScriptException {
		if (engine instanceof Compilable) {
			Compilable compEngine = (Compilable) engine;
			return compEngine.compile(script);
		}
		return null;
	}
521998
@Override
    public void execute()
            throws MojoExecutionException, MojoFailureException
        {
        boolean fExplicit = this.script != null;
        String  script    = fExplicit
                            ? this.script
                            : execution.getLifecyclePhase();

        String SCRIPT_NOT_FOUND = "Script '" + script + "' is not defined in package.json";

        Package pkg = getPackage();
        if (fExplicit && !pkg.hasScript(script))
            {
            getLog().error(SCRIPT_NOT_FOUND);
            throw new MojoFailureException(SCRIPT_NOT_FOUND);
            }
        else if (pkg.hasScript(script))
            {
            if (!fExplicit && script.endsWith("test") && skipTests)
                {
                getLog().info("Tests are skipped.");
                }
            else
                {
                CommandLine cmdLine = getNpmCommand();
                addCommand(cmdLine);
                cmdLine.addArgument(script);
                addArguments(cmdLine);

                execute(cmdLine);
                }
            }
        else
            {
            getLog().info(SCRIPT_NOT_FOUND);
            }
        }
174583
public static void setScriptsExecutable( File fileOrDir ) {

		List<File> files = new ArrayList<> ();
		if( fileOrDir.isDirectory())
			files.addAll( Utils.listAllFiles( fileOrDir, true ));
		else
			files.add( fileOrDir );

		for( File f : files )
			f.setExecutable( true );
	}
297572
public void eInit(SarlScript script, String name, IJvmTypeProvider context) {
		this.builder.eInit(script, name, context);
	}
871957
public void eInit(SarlScript script, String name, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlArtifact == null) {
			this.sarlArtifact = SarlFactory.eINSTANCE.createSarlArtifact();
			script.getXtendTypes().add(this.sarlArtifact);
			this.sarlArtifact.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration());
			if (!Strings.isEmpty(name)) {
				this.sarlArtifact.setName(name);
			}
		}
	}
368873
public void setPreInstallProgram( final String program) {
		if ( null == program) {
			format.getHeader().createEntry( PREINPROG, DEFAULTSCRIPTPROG);
		} else if ( 0 == program.length()){
			format.getHeader().createEntry( PREINPROG, DEFAULTSCRIPTPROG);
		} else {
			format.getHeader().createEntry( PREINPROG, program);
		}
	}
1017384
private void executeGalaxyScript(final String scriptName) {
    final String bashScript = String.format("cd %s; if [ -d .venv ]; then . .venv/bin/activate; fi; %s", getPath(), scriptName);
    IoUtils.executeAndWait("bash", "-c", bashScript);
  }
540210
def pre_script(self):
        
        if self['pre_script'] is None:
            return
        LOGGER.info("Executing pre script: {}".format(self['pre_script']))
        cmd = self['pre_script']
        execute_command(self.abs_input_dir(), cmd, self.env_dictionary())
        LOGGER.info("Pre Script completed")
643141
@Override
    public RPMBuilder setPostInstallation(String script, String interpreter)
    {
        addString(RPMTAG_POSTIN, script);
        addString(RPMTAG_POSTINPROG, interpreter);
        ensureBinSh();
        return this;
    }