git.iko.soy/typeable/nixpkgs
on master help sign in
metasploit: add passthru.updateScript
commitf3fa188c02e4d1f8df77a07b762c270a32baa135 authormakefu <github@syntax-fehler.de> dateSun 25 Oct 2020, 21:35 (6 years ago) parent5c79b3d
2 files changed+20−9
pkgs/tools/security/metasploit/default.nix+3−9 pkgs/tools/security/metasploit/update.sh+17
pkgs/tools/security/metasploit/default.nix+3−9
@@ -1,14 +1,5 @@
11{ stdenv, fetchFromGitHub, makeWrapper, ruby, bundlerEnv }:
22
3−# Maintainer notes for updating:
4−# 1. increment version number in expression and in Gemfile
5−# 2. run $ nix-shell --command "bundler install && bundix"
6−# in metasploit in nixpkgs
7−# 3. run $ sed -i '/[ ]*dependencies =/d' gemset.nix
8−# 4. run $ nix-build -A metasploit ../../../../
9−# 5. update sha256sum in expression
10−# 6. run step 3 again
11−
123let
134 env = bundlerEnv {
145 inherit ruby;
@@ -45,6 +36,9 @@ in stdenv.mkDerivation rec {
4536
4637 '';
4738
39+ # run with: nix-shell maintainers/scripts/update.nix --argstr path metasploit
40+ passthru.updateScript = ./update.sh;
41+
4842 meta = with stdenv.lib; {
4943 description = "Metasploit Framework - a collection of exploits";
5044 homepage = "https://github.com/rapid7/metasploit-framework/wiki";
pkgs/tools/security/metasploit/update.shnew file+17
@@ -0,0 +1,17 @@
1+#!/usr/bin/env nix-shell
2+#!nix-shell -i bash -p curl bundix git libiconv libpcap libxml2 libxslt pkg-config postgresql ruby.devEnv sqlite xmlstarlet nix-update
3+
4+set -eu -o pipefail
5+cd "$(dirname "$(readlink -f "$0")")"
6+
7+latest=$(curl https://github.com/rapid7/metasploit-framework/releases.atom | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v atom:title -n | head -n1)
8+echo "Updating metasploit to $latest"
9+
10+sed -i "s#refs/tags/.*#refs/tags/$latest\"#" Gemfile
11+
12+bundler install
13+bundix
14+sed -i '/[ ]*dependencies =/d' gemset.nix
15+
16+cd "../../../../"
17+nix-update metasploit --version "$latest"