diff --git a/bucket/astrogrep.json b/bucket/astrogrep.json index 68f05198ac8923..ff75df2119c3ec 100644 --- a/bucket/astrogrep.json +++ b/bucket/astrogrep.json @@ -3,6 +3,7 @@ "description": "A Microsoft Windows grep utility.", "homepage": "http://astrogrep.sourceforge.net/", "license": "GPL-3.0-or-later", + "notes": "Add AstroGrep as a context menu option by running: reg import \"$dir\\install-context.reg\"", "url": "https://downloads.sourceforge.net/project/astrogrep/AstroGrep%20%28Win32%29/AstroGrep%20v4.4.9/AstroGrep_v4.4.9_portable.zip", "hash": "sha1:3430dead8254aeb19dbc436f390f99c8a9687c7a", "bin": "AstroGrep.exe", @@ -12,6 +13,27 @@ "AstroGrep" ] ], + "post_install": [ + "'install-context', 'uninstall-context' | ForEach-Object {", + " if (Test-Path \"$bucketsdir\\extras\\scripts\\astrogrep\\$_.reg\") {", + " $astroPath = \"$dir\\AstroGrep.exe\".Replace('\\', '\\\\')", + " $content = (Get-Content \"$bucketsdir\\extras\\scripts\\astrogrep\\$_.reg\").Replace('$astro', $astroPath)", + " if ($global) { $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE') }", + " Set-Content \"$dir\\$_.reg\" $content -Encoding Ascii -Force", + " }", + "}" + ], + "uninstaller": { + "script": [ + "if (Test-Path \"$dir\\uninstall-context.reg\") {", + " if ($global) {", + " Write-Host \"Unregister context menu entry by running: reg import `\"$dir\\uninstall-context.reg`\"\" -ForegroundColor Yellow", + " } else {", + " reg import \"$dir\\uninstall-context.reg\"", + " }", + "}" + ] + }, "checkver": { "url": "https://sourceforge.net/projects/astrogrep/rss?path=/", "regex": "AstroGrep_v([\\d.]+)_portable\\.zip" diff --git a/scripts/astrogrep/install-context.reg b/scripts/astrogrep/install-context.reg new file mode 100644 index 00000000000000..8ede5e1fe491c7 --- /dev/null +++ b/scripts/astrogrep/install-context.reg @@ -0,0 +1,13 @@ +Windows Registry Editor Version 5.00 + +[HKEY_CURRENT_USER\Software\Classes\Directory\shell\AstroGrep] +@="Search using &AstroGrep..." +"Icon"="$astro" +[HKEY_CURRENT_USER\Software\Classes\Directory\shell\AstroGrep\command] +@="\"$astro\" \"%V\"" + +[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\AstroGrep] +@="Search using &AstroGrep..." +"Icon"="$astro" +[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\AstroGrep\command] +@="\"$astro\" \"%V\"" diff --git a/scripts/astrogrep/uninstall-context.reg b/scripts/astrogrep/uninstall-context.reg new file mode 100644 index 00000000000000..2a8bebaa1dc718 --- /dev/null +++ b/scripts/astrogrep/uninstall-context.reg @@ -0,0 +1,4 @@ +Windows Registry Editor Version 5.00 + +[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\AstroGrep] +[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\AstroGrep]