quoting stateDir path in case it includes spaces
This commit is contained in:
parent
72635ba359
commit
975f476cd2
@ -225,68 +225,68 @@ in
|
|||||||
];
|
];
|
||||||
preStart = ''
|
preStart = ''
|
||||||
# ensure cache directory exists for db:migrate command
|
# ensure cache directory exists for db:migrate command
|
||||||
mkdir -p ${cfg.stateDir}/cache
|
mkdir -p "${cfg.stateDir}/cache"
|
||||||
|
|
||||||
# create the basic directory layout the redmine package expects
|
# create the basic directory layout the redmine package expects
|
||||||
mkdir -p /run/redmine/public
|
mkdir -p /run/redmine/public
|
||||||
|
|
||||||
for i in config files log plugins tmp; do
|
for i in config files log plugins tmp; do
|
||||||
mkdir -p ${cfg.stateDir}/$i
|
mkdir -p "${cfg.stateDir}/$i"
|
||||||
ln -fs ${cfg.stateDir}/$i /run/redmine/
|
ln -fs "${cfg.stateDir}/$i" /run/redmine/
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in plugin_assets themes; do
|
for i in plugin_assets themes; do
|
||||||
mkdir -p ${cfg.stateDir}/public/$i
|
mkdir -p "${cfg.stateDir}/public/$i"
|
||||||
ln -fs ${cfg.stateDir}/public/$i /run/redmine/public/
|
ln -fs "${cfg.stateDir}/public/$i" /run/redmine/public/
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# start with a fresh config directory
|
# start with a fresh config directory
|
||||||
# the config directory is copied instead of linked as some mutable data is stored in there
|
# the config directory is copied instead of linked as some mutable data is stored in there
|
||||||
rm -rf ${cfg.stateDir}/config/*
|
rm -rf "${cfg.stateDir}/config/"*
|
||||||
cp -r ${cfg.package}/share/redmine/config.dist/* ${cfg.stateDir}/config/
|
cp -r ${cfg.package}/share/redmine/config.dist/* "${cfg.stateDir}/config/"
|
||||||
|
|
||||||
# link in the application configuration
|
# link in the application configuration
|
||||||
ln -fs ${configurationYml} ${cfg.stateDir}/config/configuration.yml
|
ln -fs ${configurationYml} "${cfg.stateDir}/config/configuration.yml"
|
||||||
|
|
||||||
|
|
||||||
# link in all user specified themes
|
# link in all user specified themes
|
||||||
rm -rf ${cfg.stateDir}/public/themes/*
|
rm -rf "${cfg.stateDir}/public/themes/"*
|
||||||
for theme in ${concatStringsSep " " (mapAttrsToList unpackTheme cfg.themes)}; do
|
for theme in ${concatStringsSep " " (mapAttrsToList unpackTheme cfg.themes)}; do
|
||||||
ln -fs $theme/* ${cfg.stateDir}/public/themes/
|
ln -fs $theme/* "${cfg.stateDir}/public/themes"
|
||||||
done
|
done
|
||||||
|
|
||||||
# link in redmine provided themes
|
# link in redmine provided themes
|
||||||
ln -sf ${cfg.package}/share/redmine/public/themes.dist/* ${cfg.stateDir}/public/themes/
|
ln -sf ${cfg.package}/share/redmine/public/themes.dist/* "${cfg.stateDir}/public/themes/"
|
||||||
|
|
||||||
|
|
||||||
# link in all user specified plugins
|
# link in all user specified plugins
|
||||||
rm -rf ${cfg.stateDir}/plugins/*
|
rm -rf "${cfg.stateDir}/plugins/"*
|
||||||
for plugin in ${concatStringsSep " " (mapAttrsToList unpackPlugin cfg.plugins)}; do
|
for plugin in ${concatStringsSep " " (mapAttrsToList unpackPlugin cfg.plugins)}; do
|
||||||
ln -fs $plugin/* ${cfg.stateDir}/plugins/''${plugin##*-redmine-plugin-}
|
ln -fs $plugin/* "${cfg.stateDir}/plugins/''${plugin##*-redmine-plugin-}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# ensure correct permissions for most files
|
# ensure correct permissions for most files
|
||||||
chmod -R ug+rwX,o-rwx+x ${cfg.stateDir}/
|
chmod -R ug+rwX,o-rwx+x "${cfg.stateDir}/"
|
||||||
|
|
||||||
|
|
||||||
# handle database.passwordFile & permissions
|
# handle database.passwordFile & permissions
|
||||||
DBPASS=$(head -n1 ${cfg.database.passwordFile})
|
DBPASS=$(head -n1 ${cfg.database.passwordFile})
|
||||||
cp -f ${databaseYml} ${cfg.stateDir}/config/database.yml
|
cp -f ${databaseYml} "${cfg.stateDir}/config/database.yml"
|
||||||
sed -e "s,#dbpass#,$DBPASS,g" -i ${cfg.stateDir}/config/database.yml
|
sed -e "s,#dbpass#,$DBPASS,g" -i "${cfg.stateDir}/config/database.yml"
|
||||||
chmod 440 ${cfg.stateDir}/config/database.yml
|
chmod 440 "${cfg.stateDir}/config/database.yml"
|
||||||
|
|
||||||
|
|
||||||
# generate a secret token if required
|
# generate a secret token if required
|
||||||
if ! test -e "${cfg.stateDir}/config/initializers/secret_token.rb"; then
|
if ! test -e "${cfg.stateDir}/config/initializers/secret_token.rb"; then
|
||||||
${bundle} exec rake generate_secret_token
|
${bundle} exec rake generate_secret_token
|
||||||
chmod 440 ${cfg.stateDir}/config/initializers/secret_token.rb
|
chmod 440 "${cfg.stateDir}/config/initializers/secret_token.rb"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# ensure everything is owned by ${cfg.user}
|
# ensure everything is owned by ${cfg.user}
|
||||||
chown -R ${cfg.user}:${cfg.group} ${cfg.stateDir}
|
chown -R ${cfg.user}:${cfg.group} "${cfg.stateDir}"
|
||||||
|
|
||||||
|
|
||||||
# execute redmine required commands prior to starting the application
|
# execute redmine required commands prior to starting the application
|
||||||
@ -297,7 +297,7 @@ in
|
|||||||
|
|
||||||
# log files don't exist until after first command has been executed
|
# log files don't exist until after first command has been executed
|
||||||
# correct ownership of files generated by calling exec rake ...
|
# correct ownership of files generated by calling exec rake ...
|
||||||
chown -R ${cfg.user}:${cfg.group} ${cfg.stateDir}/log
|
chown -R ${cfg.user}:${cfg.group} "${cfg.stateDir}/log"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
@ -307,7 +307,7 @@ in
|
|||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
TimeoutSec = "300";
|
TimeoutSec = "300";
|
||||||
WorkingDirectory = "${cfg.package}/share/redmine";
|
WorkingDirectory = "${cfg.package}/share/redmine";
|
||||||
ExecStart="${bundle} exec rails server webrick -e production -p ${toString cfg.port} -P ${cfg.stateDir}/redmine.pid";
|
ExecStart="${bundle} exec rails server webrick -e production -p ${toString cfg.port} -P '${cfg.stateDir}/redmine.pid'";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user