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