Merge remote-tracking branch 'dakrone/vagrant-umask'
This commit is contained in:
commit
2539d94bc9
|
@ -51,6 +51,7 @@ import java.nio.file.attribute.PosixFilePermission;
|
||||||
import java.nio.file.attribute.PosixFilePermissions;
|
import java.nio.file.attribute.PosixFilePermissions;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -134,6 +135,30 @@ class InstallPluginCommand extends Command {
|
||||||
private final OptionSpec<Void> batchOption;
|
private final OptionSpec<Void> batchOption;
|
||||||
private final OptionSpec<String> arguments;
|
private final OptionSpec<String> arguments;
|
||||||
|
|
||||||
|
public static final Set<PosixFilePermission> DIR_AND_EXECUTABLE_PERMS;
|
||||||
|
public static final Set<PosixFilePermission> FILE_PERMS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Set<PosixFilePermission> dirAndExecutablePerms = new HashSet<>(7);
|
||||||
|
// Directories and executables get chmod 755
|
||||||
|
dirAndExecutablePerms.add(PosixFilePermission.OWNER_EXECUTE);
|
||||||
|
dirAndExecutablePerms.add(PosixFilePermission.OWNER_READ);
|
||||||
|
dirAndExecutablePerms.add(PosixFilePermission.OWNER_WRITE);
|
||||||
|
dirAndExecutablePerms.add(PosixFilePermission.GROUP_EXECUTE);
|
||||||
|
dirAndExecutablePerms.add(PosixFilePermission.GROUP_READ);
|
||||||
|
dirAndExecutablePerms.add(PosixFilePermission.OTHERS_READ);
|
||||||
|
dirAndExecutablePerms.add(PosixFilePermission.OTHERS_EXECUTE);
|
||||||
|
DIR_AND_EXECUTABLE_PERMS = Collections.unmodifiableSet(dirAndExecutablePerms);
|
||||||
|
|
||||||
|
Set<PosixFilePermission> filePerms = new HashSet<>(4);
|
||||||
|
// Files get chmod 644
|
||||||
|
filePerms.add(PosixFilePermission.OWNER_READ);
|
||||||
|
filePerms.add(PosixFilePermission.OWNER_WRITE);
|
||||||
|
filePerms.add(PosixFilePermission.GROUP_READ);
|
||||||
|
filePerms.add(PosixFilePermission.OTHERS_READ);
|
||||||
|
FILE_PERMS = Collections.unmodifiableSet(filePerms);
|
||||||
|
}
|
||||||
|
|
||||||
InstallPluginCommand(Environment env) {
|
InstallPluginCommand(Environment env) {
|
||||||
super("Install a plugin");
|
super("Install a plugin");
|
||||||
this.env = env;
|
this.env = env;
|
||||||
|
@ -298,15 +323,7 @@ class InstallPluginCommand extends Command {
|
||||||
|
|
||||||
private Path stagingDirectory(Path pluginsDir) throws IOException {
|
private Path stagingDirectory(Path pluginsDir) throws IOException {
|
||||||
try {
|
try {
|
||||||
Set<PosixFilePermission> perms = new HashSet<>();
|
return Files.createTempDirectory(pluginsDir, ".installing-", PosixFilePermissions.asFileAttribute(DIR_AND_EXECUTABLE_PERMS));
|
||||||
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
|
||||||
perms.add(PosixFilePermission.OWNER_READ);
|
|
||||||
perms.add(PosixFilePermission.OWNER_WRITE);
|
|
||||||
perms.add(PosixFilePermission.GROUP_READ);
|
|
||||||
perms.add(PosixFilePermission.GROUP_EXECUTE);
|
|
||||||
perms.add(PosixFilePermission.OTHERS_READ);
|
|
||||||
perms.add(PosixFilePermission.OTHERS_EXECUTE);
|
|
||||||
return Files.createTempDirectory(pluginsDir, ".installing-", PosixFilePermissions.asFileAttribute(perms));
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// Jimfs throws an IAE where it should throw an UOE
|
// Jimfs throws an IAE where it should throw an UOE
|
||||||
// remove when google/jimfs#30 is integrated into Jimfs
|
// remove when google/jimfs#30 is integrated into Jimfs
|
||||||
|
@ -409,6 +426,15 @@ class InstallPluginCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
Files.move(tmpRoot, destination, StandardCopyOption.ATOMIC_MOVE);
|
Files.move(tmpRoot, destination, StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
try (DirectoryStream<Path> stream = Files.newDirectoryStream(destination)) {
|
||||||
|
for (Path pluginFile : stream) {
|
||||||
|
if (Files.isDirectory(pluginFile)) {
|
||||||
|
setFileAttributes(pluginFile, DIR_AND_EXECUTABLE_PERMS);
|
||||||
|
} else {
|
||||||
|
setFileAttributes(pluginFile, FILE_PERMS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
terminal.println("-> Installed " + info.getName());
|
terminal.println("-> Installed " + info.getName());
|
||||||
|
|
||||||
} catch (Exception installProblem) {
|
} catch (Exception installProblem) {
|
||||||
|
@ -427,17 +453,7 @@ class InstallPluginCommand extends Command {
|
||||||
throw new UserError(ExitCodes.IO_ERROR, "bin in plugin " + info.getName() + " is not a directory");
|
throw new UserError(ExitCodes.IO_ERROR, "bin in plugin " + info.getName() + " is not a directory");
|
||||||
}
|
}
|
||||||
Files.createDirectory(destBinDir);
|
Files.createDirectory(destBinDir);
|
||||||
|
setFileAttributes(destBinDir, DIR_AND_EXECUTABLE_PERMS);
|
||||||
// setup file attributes for the installed files to those of the parent dir
|
|
||||||
final Set<PosixFilePermission> perms = new HashSet<>();
|
|
||||||
final PosixFileAttributeView binAttributeView = Files.getFileAttributeView(destBinDir.getParent(), PosixFileAttributeView.class);
|
|
||||||
if (binAttributeView != null) {
|
|
||||||
perms.addAll(binAttributeView.readAttributes().permissions());
|
|
||||||
// setting execute bits, since this just means "the file is executable", and actual execution requires read
|
|
||||||
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
|
||||||
perms.add(PosixFilePermission.GROUP_EXECUTE);
|
|
||||||
perms.add(PosixFilePermission.OTHERS_EXECUTE);
|
|
||||||
}
|
|
||||||
|
|
||||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(tmpBinDir)) {
|
try (DirectoryStream<Path> stream = Files.newDirectoryStream(tmpBinDir)) {
|
||||||
for (Path srcFile : stream) {
|
for (Path srcFile : stream) {
|
||||||
|
@ -449,11 +465,7 @@ class InstallPluginCommand extends Command {
|
||||||
|
|
||||||
Path destFile = destBinDir.resolve(tmpBinDir.relativize(srcFile));
|
Path destFile = destBinDir.resolve(tmpBinDir.relativize(srcFile));
|
||||||
Files.copy(srcFile, destFile);
|
Files.copy(srcFile, destFile);
|
||||||
|
setFileAttributes(destFile, DIR_AND_EXECUTABLE_PERMS);
|
||||||
final PosixFileAttributeView view = Files.getFileAttributeView(destFile, PosixFileAttributeView.class);
|
|
||||||
if (view != null) {
|
|
||||||
view.setPermissions(perms);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IOUtils.rm(tmpBinDir); // clean up what we just copied
|
IOUtils.rm(tmpBinDir); // clean up what we just copied
|
||||||
|
@ -468,8 +480,8 @@ class InstallPluginCommand extends Command {
|
||||||
throw new UserError(ExitCodes.IO_ERROR, "config in plugin " + info.getName() + " is not a directory");
|
throw new UserError(ExitCodes.IO_ERROR, "config in plugin " + info.getName() + " is not a directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the plugin's config dir "if necessary"
|
|
||||||
Files.createDirectories(destConfigDir);
|
Files.createDirectories(destConfigDir);
|
||||||
|
setFileAttributes(destConfigDir, DIR_AND_EXECUTABLE_PERMS);
|
||||||
final PosixFileAttributeView destConfigDirAttributesView =
|
final PosixFileAttributeView destConfigDirAttributesView =
|
||||||
Files.getFileAttributeView(destConfigDir.getParent(), PosixFileAttributeView.class);
|
Files.getFileAttributeView(destConfigDir.getParent(), PosixFileAttributeView.class);
|
||||||
final PosixFileAttributes destConfigDirAttributes =
|
final PosixFileAttributes destConfigDirAttributes =
|
||||||
|
@ -487,6 +499,7 @@ class InstallPluginCommand extends Command {
|
||||||
Path destFile = destConfigDir.resolve(tmpConfigDir.relativize(srcFile));
|
Path destFile = destConfigDir.resolve(tmpConfigDir.relativize(srcFile));
|
||||||
if (Files.exists(destFile) == false) {
|
if (Files.exists(destFile) == false) {
|
||||||
Files.copy(srcFile, destFile);
|
Files.copy(srcFile, destFile);
|
||||||
|
setFileAttributes(destFile, FILE_PERMS);
|
||||||
if (destConfigDirAttributes != null) {
|
if (destConfigDirAttributes != null) {
|
||||||
setOwnerGroup(destFile, destConfigDirAttributes);
|
setOwnerGroup(destFile, destConfigDirAttributes);
|
||||||
}
|
}
|
||||||
|
@ -504,4 +517,13 @@ class InstallPluginCommand extends Command {
|
||||||
fileAttributeView.setGroup(attributes.group());
|
fileAttributeView.setGroup(attributes.group());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the attributes for a path iff posix attributes are supported
|
||||||
|
*/
|
||||||
|
private static void setFileAttributes(final Path path, final Set<PosixFilePermission> permissions) throws IOException {
|
||||||
|
PosixFileAttributeView fileAttributeView = Files.getFileAttributeView(path, PosixFileAttributeView.class);
|
||||||
|
if (fileAttributeView != null) {
|
||||||
|
Files.setPosixFilePermissions(path, permissions);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,6 +239,8 @@ configure(subprojects.findAll { ['deb', 'rpm'].contains(it.name) }) {
|
||||||
dependsOn createEtc, createEtcScripts
|
dependsOn createEtc, createEtcScripts
|
||||||
with configFiles
|
with configFiles
|
||||||
into "${packagingFiles}/etc/elasticsearch"
|
into "${packagingFiles}/etc/elasticsearch"
|
||||||
|
fileMode 0640
|
||||||
|
dirMode 0750
|
||||||
/* Explicitly declare the output files so this task doesn't consider itself
|
/* Explicitly declare the output files so this task doesn't consider itself
|
||||||
up to date when the directory is created, which it would by default. And
|
up to date when the directory is created, which it would by default. And
|
||||||
that'll happen when createEtc runs. */
|
that'll happen when createEtc runs. */
|
||||||
|
@ -303,6 +305,8 @@ configure(subprojects.findAll { ['deb', 'rpm'].contains(it.name) }) {
|
||||||
postUninstall file("${scripts}/postrm")
|
postUninstall file("${scripts}/postrm")
|
||||||
|
|
||||||
into '/usr/share/elasticsearch'
|
into '/usr/share/elasticsearch'
|
||||||
|
fileMode 0644
|
||||||
|
dirMode 0755
|
||||||
user 'root'
|
user 'root'
|
||||||
permissionGroup 'root'
|
permissionGroup 'root'
|
||||||
with libFiles
|
with libFiles
|
||||||
|
@ -344,6 +348,8 @@ configure(subprojects.findAll { ['deb', 'rpm'].contains(it.name) }) {
|
||||||
configurationFile project.expansions['path.env']
|
configurationFile project.expansions['path.env']
|
||||||
into(new File(project.expansions['path.env']).getParent()) {
|
into(new File(project.expansions['path.env']).getParent()) {
|
||||||
from "${project.packagingFiles}/env/elasticsearch"
|
from "${project.packagingFiles}/env/elasticsearch"
|
||||||
|
fileMode 0644
|
||||||
|
dirMode 0755
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -351,6 +357,7 @@ configure(subprojects.findAll { ['deb', 'rpm'].contains(it.name) }) {
|
||||||
*/
|
*/
|
||||||
Closure suckUpEmptyDirectories = { path, u, g ->
|
Closure suckUpEmptyDirectories = { path, u, g ->
|
||||||
into(path) {
|
into(path) {
|
||||||
|
fileMode 0755
|
||||||
from "${packagingFiles}/${path}"
|
from "${packagingFiles}/${path}"
|
||||||
includeEmptyDirs true
|
includeEmptyDirs true
|
||||||
createDirectoryEntry true
|
createDirectoryEntry true
|
||||||
|
|
|
@ -31,6 +31,7 @@ task buildDeb(type: Deb) {
|
||||||
}
|
}
|
||||||
into('/usr/share/doc/elasticsearch') {
|
into('/usr/share/doc/elasticsearch') {
|
||||||
from "${project.packagingFiles}/copyright"
|
from "${project.packagingFiles}/copyright"
|
||||||
|
fileMode 0644
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ task buildRpm(type: Rpm) {
|
||||||
license '2009'
|
license '2009'
|
||||||
distribution 'Elasticsearch'
|
distribution 'Elasticsearch'
|
||||||
vendor 'Elasticsearch'
|
vendor 'Elasticsearch'
|
||||||
|
dirMode 0755
|
||||||
|
fileMode 0644
|
||||||
// TODO ospackage doesn't support icon but we used to have one
|
// TODO ospackage doesn't support icon but we used to have one
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,5 +99,11 @@ fi
|
||||||
chown -R $ES_USER:$ES_GROUP /var/lib/elasticsearch
|
chown -R $ES_USER:$ES_GROUP /var/lib/elasticsearch
|
||||||
chown -R $ES_USER:$ES_GROUP /var/log/elasticsearch
|
chown -R $ES_USER:$ES_GROUP /var/log/elasticsearch
|
||||||
chown -R root:$ES_GROUP /etc/elasticsearch
|
chown -R root:$ES_GROUP /etc/elasticsearch
|
||||||
|
chmod 0750 /etc/elasticsearch
|
||||||
|
chmod 0750 /etc/elasticsearch/scripts
|
||||||
|
|
||||||
|
if [ -f /etc/sysconfig/elasticsearch ]; then
|
||||||
|
chmod 0644 /etc/sysconfig/elasticsearch
|
||||||
|
fi
|
||||||
|
|
||||||
${scripts.footer}
|
${scripts.footer}
|
||||||
|
|
|
@ -22,6 +22,8 @@ task buildTar(type: Tar) {
|
||||||
extension = 'tar.gz'
|
extension = 'tar.gz'
|
||||||
with archivesFiles
|
with archivesFiles
|
||||||
compression = Compression.GZIP
|
compression = Compression.GZIP
|
||||||
|
dirMode 0755
|
||||||
|
fileMode 0644
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
|
|
|
@ -236,11 +236,7 @@ public class InstallPluginCommandTests extends ESTestCase {
|
||||||
assertFalse("not a dir", Files.isDirectory(file));
|
assertFalse("not a dir", Files.isDirectory(file));
|
||||||
if (isPosix) {
|
if (isPosix) {
|
||||||
PosixFileAttributes attributes = Files.readAttributes(file, PosixFileAttributes.class);
|
PosixFileAttributes attributes = Files.readAttributes(file, PosixFileAttributes.class);
|
||||||
Set<PosixFilePermission> expectedPermissions = new HashSet<>(binAttributes.permissions());
|
assertEquals(InstallPluginCommand.DIR_AND_EXECUTABLE_PERMS, attributes.permissions());
|
||||||
expectedPermissions.add(PosixFilePermission.OWNER_EXECUTE);
|
|
||||||
expectedPermissions.add(PosixFilePermission.GROUP_EXECUTE);
|
|
||||||
expectedPermissions.add(PosixFilePermission.OTHERS_EXECUTE);
|
|
||||||
assertEquals(expectedPermissions, attributes.permissions());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,14 +134,18 @@ skip_not_zip() {
|
||||||
|
|
||||||
assert_file_exist() {
|
assert_file_exist() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
echo "Should exist: ${file}"
|
if [ ! -e "$file" ]; then
|
||||||
|
echo "Should exist: ${file} but does not"
|
||||||
|
fi
|
||||||
local file=$(readlink -m "${file}")
|
local file=$(readlink -m "${file}")
|
||||||
[ -e "$file" ]
|
[ -e "$file" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_file_not_exist() {
|
assert_file_not_exist() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
echo "Should not exist: ${file}"
|
if [ -e "$file" ]; then
|
||||||
|
echo "Should not exist: ${file} but does"
|
||||||
|
fi
|
||||||
local file=$(readlink -m "${file}")
|
local file=$(readlink -m "${file}")
|
||||||
[ ! -e "$file" ]
|
[ ! -e "$file" ]
|
||||||
}
|
}
|
||||||
|
@ -156,28 +160,38 @@ assert_file() {
|
||||||
assert_file_exist "$file"
|
assert_file_exist "$file"
|
||||||
|
|
||||||
if [ "$type" = "d" ]; then
|
if [ "$type" = "d" ]; then
|
||||||
echo "And be a directory...."
|
if [ ! -d "$file" ]; then
|
||||||
|
echo "[$file] should be a directory but is not"
|
||||||
|
fi
|
||||||
[ -d "$file" ]
|
[ -d "$file" ]
|
||||||
else
|
else
|
||||||
echo "And be a regular file...."
|
if [ ! -f "$file" ]; then
|
||||||
|
echo "[$file] should be a regular file but is not"
|
||||||
|
fi
|
||||||
[ -f "$file" ]
|
[ -f "$file" ]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$user" != "x" ]; then
|
if [ "x$user" != "x" ]; then
|
||||||
realuser=$(find "$file" -maxdepth 0 -printf "%u")
|
realuser=$(find "$file" -maxdepth 0 -printf "%u")
|
||||||
echo "Expected user: $user, found $realuser"
|
if [ "$realuser" != "$user" ]; then
|
||||||
|
echo "Expected user: $user, found $realuser [$file]"
|
||||||
|
fi
|
||||||
[ "$realuser" = "$user" ]
|
[ "$realuser" = "$user" ]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$group" != "x" ]; then
|
if [ "x$group" != "x" ]; then
|
||||||
realgroup=$(find "$file" -maxdepth 0 -printf "%g")
|
realgroup=$(find "$file" -maxdepth 0 -printf "%g")
|
||||||
echo "Expected group: $group, found $realgroup"
|
if [ "$realgroup" != "$group" ]; then
|
||||||
|
echo "Expected group: $group, found $realgroup [$file]"
|
||||||
|
fi
|
||||||
[ "$realgroup" = "$group" ]
|
[ "$realgroup" = "$group" ]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$privileges" != "x" ]; then
|
if [ "x$privileges" != "x" ]; then
|
||||||
realprivileges=$(find "$file" -maxdepth 0 -printf "%m")
|
realprivileges=$(find "$file" -maxdepth 0 -printf "%m")
|
||||||
echo "Expected privileges: $privileges, found $realprivileges"
|
if [ "$realprivileges" != "$privileges" ]; then
|
||||||
|
echo "Expected privileges: $privileges, found $realprivileges [$file]"
|
||||||
|
fi
|
||||||
[ "$realprivileges" = "$privileges" ]
|
[ "$realprivileges" = "$privileges" ]
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -190,10 +204,8 @@ assert_module_or_plugin_directory() {
|
||||||
#just make sure that everything is the same as $CONFIG_DIR, which was properly set up during install
|
#just make sure that everything is the same as $CONFIG_DIR, which was properly set up during install
|
||||||
config_user=$(find "$ESHOME" -maxdepth 0 -printf "%u")
|
config_user=$(find "$ESHOME" -maxdepth 0 -printf "%u")
|
||||||
config_owner=$(find "$ESHOME" -maxdepth 0 -printf "%g")
|
config_owner=$(find "$ESHOME" -maxdepth 0 -printf "%g")
|
||||||
# directories should use the user file-creation mask
|
|
||||||
config_privileges=$(executable_privileges_for_user_from_umask $ESPLUGIN_COMMAND_USER)
|
|
||||||
|
|
||||||
assert_file $directory d $config_user $config_owner $(printf "%o" $config_privileges)
|
assert_file $directory d $config_user $config_owner 755
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_module_or_plugin_file() {
|
assert_module_or_plugin_file() {
|
||||||
|
@ -201,11 +213,7 @@ assert_module_or_plugin_file() {
|
||||||
shift
|
shift
|
||||||
|
|
||||||
assert_file_exist "$(readlink -m $file)"
|
assert_file_exist "$(readlink -m $file)"
|
||||||
|
assert_file $file f $config_user $config_owner 644
|
||||||
# config files should not be executable and otherwise use the user
|
|
||||||
# file-creation mask
|
|
||||||
expected_file_privileges=$(file_privileges_for_user_from_umask $ESPLUGIN_COMMAND_USER)
|
|
||||||
assert_file $file f $config_user $config_owner $(printf "%o" $expected_file_privileges)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_output() {
|
assert_output() {
|
||||||
|
|
|
@ -84,20 +84,16 @@ install_jvm_example() {
|
||||||
bin_user=$(find "$ESHOME/bin" -maxdepth 0 -printf "%u")
|
bin_user=$(find "$ESHOME/bin" -maxdepth 0 -printf "%u")
|
||||||
bin_owner=$(find "$ESHOME/bin" -maxdepth 0 -printf "%g")
|
bin_owner=$(find "$ESHOME/bin" -maxdepth 0 -printf "%g")
|
||||||
bin_privileges=$(find "$ESHOME/bin" -maxdepth 0 -printf "%m")
|
bin_privileges=$(find "$ESHOME/bin" -maxdepth 0 -printf "%m")
|
||||||
assert_file "$ESHOME/bin/jvm-example" d $bin_user $bin_owner $bin_privileges
|
assert_file "$ESHOME/bin/jvm-example" d $bin_user $bin_owner 755
|
||||||
assert_file "$ESHOME/bin/jvm-example/test" f $bin_user $bin_owner $bin_privileges
|
assert_file "$ESHOME/bin/jvm-example/test" f $bin_user $bin_owner 755
|
||||||
|
|
||||||
#owner group and permissions vary depending on how es was installed
|
#owner group and permissions vary depending on how es was installed
|
||||||
#just make sure that everything is the same as $CONFIG_DIR, which was properly set up during install
|
#just make sure that everything is the same as $CONFIG_DIR, which was properly set up during install
|
||||||
config_user=$(find "$ESCONFIG" -maxdepth 0 -printf "%u")
|
config_user=$(find "$ESCONFIG" -maxdepth 0 -printf "%u")
|
||||||
config_owner=$(find "$ESCONFIG" -maxdepth 0 -printf "%g")
|
config_owner=$(find "$ESCONFIG" -maxdepth 0 -printf "%g")
|
||||||
# directories should user the user file-creation mask
|
# directories should user the user file-creation mask
|
||||||
config_privileges=$(executable_privileges_for_user_from_umask $ESPLUGIN_COMMAND_USER)
|
assert_file "$ESCONFIG/jvm-example" d $config_user $config_owner 755
|
||||||
assert_file "$ESCONFIG/jvm-example" d $config_user $config_owner $(printf "%o" $config_privileges)
|
assert_file "$ESCONFIG/jvm-example/example.yaml" f $config_user $config_owner 644
|
||||||
# config files should not be executable and otherwise use the user
|
|
||||||
# file-creation mask
|
|
||||||
expected_file_privileges=$(file_privileges_for_user_from_umask $ESPLUGIN_COMMAND_USER)
|
|
||||||
assert_file "$ESCONFIG/jvm-example/example.yaml" f $config_user $config_owner $(printf "%o" $expected_file_privileges)
|
|
||||||
|
|
||||||
echo "Running jvm-example's bin script...."
|
echo "Running jvm-example's bin script...."
|
||||||
"$ESHOME/bin/jvm-example/test" | grep test
|
"$ESHOME/bin/jvm-example/test" | grep test
|
||||||
|
|
|
@ -33,7 +33,7 @@ install_archive() {
|
||||||
echo "Unpacking tarball to $ESHOME"
|
echo "Unpacking tarball to $ESHOME"
|
||||||
rm -rf /tmp/untar
|
rm -rf /tmp/untar
|
||||||
mkdir -p /tmp/untar
|
mkdir -p /tmp/untar
|
||||||
tar -xzf elasticsearch*.tar.gz -C /tmp/untar
|
tar -xzpf elasticsearch*.tar.gz -C /tmp/untar
|
||||||
|
|
||||||
find /tmp/untar -depth -type d -name 'elasticsearch*' -exec mv {} "$ESHOME" \; > /dev/null
|
find /tmp/untar -depth -type d -name 'elasticsearch*' -exec mv {} "$ESHOME" \; > /dev/null
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue