mysqltuner: do not pollute global /share

This commit is contained in:
Peter Hoeg 2021-02-22 10:38:54 +08:00
parent 0932f80bb7
commit 2f97bd1110

View File

@ -5,16 +5,15 @@ stdenv.mkDerivation rec {
version = "1.7.21";
src = fetchFromGitHub {
owner = "major";
repo = "MySQLTuner-perl";
rev = version;
owner = "major";
repo = "MySQLTuner-perl";
rev = version;
sha256 = "sha256-Yv1XjD8sZcmGr2SVD6TEElUH7vspJ61WwQwfXLOrao0=";
};
postPatch = ''
substituteInPlace mysqltuner.pl \
--replace '$basic_password_files = "/usr/share/mysqltuner/basic_passwords.txt"' "\$basic_password_files = \"$out/share/basic_passwords.txt\"" \
--replace '$opt{cvefile} = "/usr/share/mysqltuner/vulnerabilities.csv"' "\$opt{cvefile} = \"$out/share/vulnerabilities.csv\""
--replace '/usr/share' "$out/share"
'';
buildInputs = [ perl ];
@ -22,10 +21,8 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
mkdir -p "$out/bin"
install -Dm 0755 mysqltuner.pl "$out/bin/mysqltuner"
install -Dm 0644 basic_passwords.txt "$out/share/basic_passwords.txt"
install -Dm 0644 vulnerabilities.csv "$out/share/vulnerabilities.csv"
install -Dm0555 mysqltuner.pl $out/bin/mysqltuner
install -Dm0444 -t $out/share/mysqltuner basic_passwords.txt vulnerabilities.csv
runHook postInstall
'';