JCLOUDS-67: Filtered license headers from script fragments

This commit is contained in:
Ignasi Barrera 2013-05-20 16:37:36 +02:00
parent d17efa34a1
commit a18557635d
20 changed files with 156 additions and 1024 deletions

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function bootstrap { function bootstrap {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {
@ -127,42 +79,10 @@ END_OF_JCLOUDS_SCRIPT
export LOG_DIR='$LOG_DIR' export LOG_DIR='$LOG_DIR'
END_OF_JCLOUDS_SCRIPT END_OF_JCLOUDS_SCRIPT
cat >> $INSTANCE_HOME/bootstrap.sh <<-'END_OF_JCLOUDS_SCRIPT' cat >> $INSTANCE_HOME/bootstrap.sh <<-'END_OF_JCLOUDS_SCRIPT'
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
alias apt-get-update="apt-get update -qq" alias apt-get-update="apt-get update -qq"
alias apt-get-install="apt-get install -f -y -qq --force-yes" alias apt-get-install="apt-get install -f -y -qq --force-yes"
alias yum-install="yum --quiet --nogpgcheck -y install" alias yum-install="yum --quiet --nogpgcheck -y install"
@ -222,22 +142,6 @@ function setupPublicCurl() {
ensure_can_resolve_public_dns ensure_can_resolve_public_dns
return 0 return 0
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# adds JAVA_HOME and into PATH in global and user-specific profiles # adds JAVA_HOME and into PATH in global and user-specific profiles
function setupJavaHomeInProfile() { function setupJavaHomeInProfile() {
PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc) PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc)

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function configure-jetty { function configure-jetty {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {
@ -127,42 +79,10 @@ END_OF_JCLOUDS_SCRIPT
export LOG_DIR='$LOG_DIR' export LOG_DIR='$LOG_DIR'
END_OF_JCLOUDS_SCRIPT END_OF_JCLOUDS_SCRIPT
cat >> $INSTANCE_HOME/configure-jetty.sh <<-'END_OF_JCLOUDS_SCRIPT' cat >> $INSTANCE_HOME/configure-jetty.sh <<-'END_OF_JCLOUDS_SCRIPT'
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
alias apt-get-update="apt-get update -qq" alias apt-get-update="apt-get update -qq"
alias apt-get-install="apt-get install -f -y -qq --force-yes" alias apt-get-install="apt-get install -f -y -qq --force-yes"
alias yum-install="yum --quiet --nogpgcheck -y install" alias yum-install="yum --quiet --nogpgcheck -y install"
@ -222,22 +142,6 @@ function setupPublicCurl() {
ensure_can_resolve_public_dns ensure_can_resolve_public_dns
return 0 return 0
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# adds JAVA_HOME and into PATH in global and user-specific profiles # adds JAVA_HOME and into PATH in global and user-specific profiles
function setupJavaHomeInProfile() { function setupJavaHomeInProfile() {
PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc) PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc)

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function runScriptWithCreds { function runScriptWithCreds {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {
@ -127,42 +79,10 @@ END_OF_JCLOUDS_SCRIPT
export LOG_DIR='$LOG_DIR' export LOG_DIR='$LOG_DIR'
END_OF_JCLOUDS_SCRIPT END_OF_JCLOUDS_SCRIPT
cat >> $INSTANCE_HOME/runScriptWithCreds.sh <<-'END_OF_JCLOUDS_SCRIPT' cat >> $INSTANCE_HOME/runScriptWithCreds.sh <<-'END_OF_JCLOUDS_SCRIPT'
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
alias apt-get-update="apt-get update -qq" alias apt-get-update="apt-get update -qq"
alias apt-get-install="apt-get install -f -y -qq --force-yes" alias apt-get-install="apt-get install -f -y -qq --force-yes"
alias yum-install="yum --quiet --nogpgcheck -y install" alias yum-install="yum --quiet --nogpgcheck -y install"
@ -222,22 +142,6 @@ function setupPublicCurl() {
ensure_can_resolve_public_dns ensure_can_resolve_public_dns
return 0 return 0
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# adds JAVA_HOME and into PATH in global and user-specific profiles # adds JAVA_HOME and into PATH in global and user-specific profiles
function setupJavaHomeInProfile() { function setupJavaHomeInProfile() {
PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc) PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc)

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function adminUpdate { function adminUpdate {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {

View File

@ -78,10 +78,6 @@
<exclude>**/README.md</exclude> <exclude>**/README.md</exclude>
<exclude>**/README.txt</exclude> <exclude>**/README.txt</exclude>
<!-- temporarily exclude shell script fragments -->
<exclude>**/*sh</exclude>
<exclude>**/*cmd</exclude>
<!-- reference data lists --> <!-- reference data lists -->
<exclude>**/*json</exclude> <exclude>**/*json</exclude>
<exclude>**/*readme</exclude> <exclude>**/*readme</exclude>
@ -150,10 +146,6 @@
<exclude>**/README.md</exclude> <exclude>**/README.md</exclude>
<exclude>**/README.txt</exclude> <exclude>**/README.txt</exclude>
<!-- temporarily exclude shell script fragments -->
<exclude>**/*sh</exclude>
<exclude>**/*cmd</exclude>
<!-- reference data lists --> <!-- reference data lists -->
<exclude>**/*json</exclude> <exclude>**/*json</exclude>
<exclude>**/*readme</exclude> <exclude>**/*readme</exclude>

View File

@ -18,6 +18,8 @@ package org.jclouds.scriptbuilder.functionloader;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.jclouds.scriptbuilder.functionloader.filters.LicenseHeaderFilter;
import com.google.common.util.concurrent.Atomics; import com.google.common.util.concurrent.Atomics;
/** /**
@ -29,7 +31,8 @@ public class CurrentFunctionLoader {
BasicFunctionLoader.INSTANCE); BasicFunctionLoader.INSTANCE);
public static FunctionLoader get() { public static FunctionLoader get() {
return ref.get(); // Filter out license headers in function scripts
return new LicenseHeaderFilter(ref.get());
} }
public static FunctionLoader set(FunctionLoader loader) { public static FunctionLoader set(FunctionLoader loader) {

View File

@ -0,0 +1,145 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.scriptbuilder.functionloader.filters;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.io.CharStreams.newReaderSupplier;
import static com.google.common.io.CharStreams.readLines;
import java.io.IOException;
import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.scriptbuilder.domain.ShellToken;
import org.jclouds.scriptbuilder.functionloader.FunctionLoader;
import org.jclouds.scriptbuilder.functionloader.FunctionNotFoundException;
import com.google.common.io.LineProcessor;
/**
* FunctionLoader decorator to filters out license header comments from a file.
*
* @author Ignasi Barrera
*/
public class LicenseHeaderFilter implements FunctionLoader {
/** The target function loader. */
private final FunctionLoader delegate;
public LicenseHeaderFilter(FunctionLoader delegate) {
this.delegate = checkNotNull(delegate, "delegate");
}
@Override
public String loadFunction(String function, OsFamily family) throws FunctionNotFoundException {
return filter(delegate.loadFunction(function, family), family);
}
/**
* Filters out license header comments from a file.
* @param lines The lines to filter.
* @param family The {@link OsFamily} of the file.
* @return The filtered file.
*/
public String filter(String lines, OsFamily family) {
try {
return readLines(newReaderSupplier(checkNotNull(lines, "lines")),
new LicenseHeaderProcessor(checkNotNull(family, "family")));
} catch (IOException e) {
// Don't fail; just return the original text with the comments
return lines;
}
}
/**
* Line by line processor.
*
* @author Ignasi Barrera
*/
private static class LicenseHeaderProcessor implements LineProcessor<String> {
/** Search token used to identify license header comments beginning. */
private static final String LICENSE_TOKEN_START = "Licensed to the Apache Software Foundation";
/** Search token used to identify license header comments end. */
private static final String LICENSE_TOKEN_END = "limitations under the License";
/** The resulting text, without the license header comments. */
private final StringBuilder builder;
/** The comment token for the given OsFamily */
private final String commentToken;
/** The line termination token for the given OsFamily */
private final String lineTerminationToken;
/** Flag to indicate that a license header comment is being processed. */
private boolean isLicenseComment;
public LicenseHeaderProcessor(OsFamily family) {
builder = new StringBuilder();
commentToken = ShellToken.REM.to(family);
lineTerminationToken = ShellToken.LF.to(family);
isLicenseComment = false;
}
@Override
public boolean processLine(String line) throws IOException {
String trimmed = line.trim();
boolean isComment = isCommentLine(trimmed);
if (isComment && line.contains(LICENSE_TOKEN_START)) {
// License found, start skipping following comment lines
isLicenseComment = true;
}
// Remove empty comment lines (licenses are prefixed and suffixed with
// empty comments)
if (!isLicenseComment && !isEmptyCommentLine(trimmed)) {
builder.append(line);
builder.append(lineTerminationToken);
}
if (isLicenseComment && line.contains(LICENSE_TOKEN_END)) {
// Reset the license flag to avoid filtering other comments
isLicenseComment = false;
}
return true; // Continue processing lines
}
@Override
public String getResult() {
return builder.toString();
}
/**
* Checks if the given line is an empty comment line.
*/
private boolean isEmptyCommentLine(String line) {
// ShellToken.REM.to(WINDOWS) has a '@' prefix but not all comments do
return line.equals(commentToken) || line.equals("REM");
}
/**
* Checks if the given line is a comment line.
*/
private boolean isCommentLine(String line) {
// ShellToken.REM.to(WINDOWS) has a '@' prefix but not all comments do
return line.startsWith(commentToken) || line.startsWith("REM");
}
}
}

View File

@ -3,41 +3,9 @@ set PATH=
set JAVA_HOME= set JAVA_HOME=
set PATH= set PATH=
GOTO FUNCTION_END GOTO FUNCTION_END
REM
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
:abort :abort
echo aborting: %EXCEPTION% echo aborting: %EXCEPTION%
exit /b 1 exit /b 1
REM
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
:findPid :findPid
set FOUND_PID= set FOUND_PID=
set _expression=%1 set _expression=%1

View File

@ -3,42 +3,10 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -33,22 +17,6 @@ function mkebsboot {
export TMP_DIR="/mnt/tmp" export TMP_DIR="/mnt/tmp"
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -64,22 +32,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function testcall { function testcall {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {
@ -128,42 +80,10 @@ END_OF_JCLOUDS_SCRIPT
export LOG_DIR='$LOG_DIR' export LOG_DIR='$LOG_DIR'
END_OF_JCLOUDS_SCRIPT END_OF_JCLOUDS_SCRIPT
cat >> $INSTANCE_HOME/testcall.sh <<-'END_OF_JCLOUDS_SCRIPT' cat >> $INSTANCE_HOME/testcall.sh <<-'END_OF_JCLOUDS_SCRIPT'
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function sourceEnvFile { function sourceEnvFile {
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
abort "sourceEnvFile requires a parameter of the file to source" abort "sourceEnvFile requires a parameter of the file to source"

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function install_chef_gems { function install_chef_gems {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function install_git { function install_git {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {
@ -127,42 +79,10 @@ END_OF_JCLOUDS_SCRIPT
export LOG_DIR='$LOG_DIR' export LOG_DIR='$LOG_DIR'
END_OF_JCLOUDS_SCRIPT END_OF_JCLOUDS_SCRIPT
cat >> $INSTANCE_HOME/install_git.sh <<-'END_OF_JCLOUDS_SCRIPT' cat >> $INSTANCE_HOME/install_git.sh <<-'END_OF_JCLOUDS_SCRIPT'
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
alias apt-get-update="apt-get update -qq" alias apt-get-update="apt-get update -qq"
alias apt-get-install="apt-get install -f -y -qq --force-yes" alias apt-get-install="apt-get install -f -y -qq --force-yes"
alias yum-install="yum --quiet --nogpgcheck -y install" alias yum-install="yum --quiet --nogpgcheck -y install"
@ -222,22 +142,6 @@ function setupPublicCurl() {
ensure_can_resolve_public_dns ensure_can_resolve_public_dns
return 0 return 0
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function installGit() { function installGit() {
if which dpkg &> /dev/null; then if which dpkg &> /dev/null; then
ensure_cmd_or_install_package_apt git git-core ensure_cmd_or_install_package_apt git git-core

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function install_jdk { function install_jdk {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {
@ -127,42 +79,10 @@ END_OF_JCLOUDS_SCRIPT
export LOG_DIR='$LOG_DIR' export LOG_DIR='$LOG_DIR'
END_OF_JCLOUDS_SCRIPT END_OF_JCLOUDS_SCRIPT
cat >> $INSTANCE_HOME/install_jdk.sh <<-'END_OF_JCLOUDS_SCRIPT' cat >> $INSTANCE_HOME/install_jdk.sh <<-'END_OF_JCLOUDS_SCRIPT'
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
alias apt-get-update="apt-get update -qq" alias apt-get-update="apt-get update -qq"
alias apt-get-install="apt-get install -f -y -qq --force-yes" alias apt-get-install="apt-get install -f -y -qq --force-yes"
alias yum-install="yum --quiet --nogpgcheck -y install" alias yum-install="yum --quiet --nogpgcheck -y install"
@ -222,22 +142,6 @@ function setupPublicCurl() {
ensure_can_resolve_public_dns ensure_can_resolve_public_dns
return 0 return 0
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# adds JAVA_HOME and into PATH in global and user-specific profiles # adds JAVA_HOME and into PATH in global and user-specific profiles
function setupJavaHomeInProfile() { function setupJavaHomeInProfile() {
PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc) PROFILES=(/etc/bashrc $HOME/.bashrc /etc/skel/.bashrc)

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function install_ruby { function install_ruby {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {
@ -127,42 +79,10 @@ END_OF_JCLOUDS_SCRIPT
export LOG_DIR='$LOG_DIR' export LOG_DIR='$LOG_DIR'
END_OF_JCLOUDS_SCRIPT END_OF_JCLOUDS_SCRIPT
cat >> $INSTANCE_HOME/install_ruby.sh <<-'END_OF_JCLOUDS_SCRIPT' cat >> $INSTANCE_HOME/install_ruby.sh <<-'END_OF_JCLOUDS_SCRIPT'
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
alias apt-get-update="apt-get update -qq" alias apt-get-update="apt-get update -qq"
alias apt-get-install="apt-get install -f -y -qq --force-yes" alias apt-get-install="apt-get install -f -y -qq --force-yes"
alias yum-install="yum --quiet --nogpgcheck -y install" alias yum-install="yum --quiet --nogpgcheck -y install"
@ -222,22 +142,6 @@ function setupPublicCurl() {
ensure_can_resolve_public_dns ensure_can_resolve_public_dns
return 0 return 0
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function installRuby() { function installRuby() {
if ! hash ruby 2>/dev/null; then if ! hash ruby 2>/dev/null; then
if which dpkg &> /dev/null; then if which dpkg &> /dev/null; then

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
@ -32,22 +16,6 @@ export LOG_DIR="$INSTANCE_HOME"
function install_rubygems { function install_rubygems {
return $? return $?
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {
@ -63,22 +31,6 @@ function findPid {
return 1 return 1
} }
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function forget { function forget {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 3 ] || { [ $# -eq 3 ] || {

View File

@ -4,22 +4,6 @@ set JAVA_HOME=
set PATH= set PATH=
set RUNTIME= set RUNTIME=
GOTO FUNCTION_END GOTO FUNCTION_END
REM
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
:abort :abort
echo aborting: %EXCEPTION% echo aborting: %EXCEPTION%
exit /b 1 exit /b 1

View File

@ -3,22 +3,6 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH RUNTIME unset PATH JAVA_HOME LD_LIBRARY_PATH RUNTIME
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1

View File

@ -3,41 +3,9 @@ set PATH=
set JAVA_HOME= set JAVA_HOME=
set PATH= set PATH=
GOTO FUNCTION_END GOTO FUNCTION_END
REM
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
:abort :abort
echo aborting: %EXCEPTION% echo aborting: %EXCEPTION%
exit /b 1 exit /b 1
REM
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
:findPid :findPid
set FOUND_PID= set FOUND_PID=
set _expression=%1 set _expression=%1

View File

@ -3,42 +3,10 @@ set +u
shopt -s xpg_echo shopt -s xpg_echo
shopt -s expand_aliases shopt -s expand_aliases
unset PATH JAVA_HOME LD_LIBRARY_PATH unset PATH JAVA_HOME LD_LIBRARY_PATH
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function abort { function abort {
echo "aborting: $@" 1>&2 echo "aborting: $@" 1>&2
exit 1 exit 1
} }
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function findPid { function findPid {
unset FOUND_PID; unset FOUND_PID;
[ $# -eq 1 ] || { [ $# -eq 1 ] || {