chezmoi: re-add pass-unlock-patch
Speeds up chezmoi + pass a lot.
This commit is contained in:
parent
12c9a1e0c9
commit
d2c4a477b2
@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Manage your dotfiles across multiple machines"
|
||||
TERMUX_PKG_LICENSE="MIT"
|
||||
TERMUX_PKG_MAINTAINER="Henrik Grimler @Grimler91"
|
||||
TERMUX_PKG_VERSION=1.8.4
|
||||
TERMUX_PKG_REVISION=1
|
||||
TERMUX_PKG_SRCURL=https://github.com/twpayne/chezmoi/archive/v${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_SHA256=655f8a478d1aeddc4cfa5b10ddd780bcd30d3e64106697b14ecffb95fff0b133
|
||||
|
||||
|
69
packages/chezmoi/pass-no-unlock.patch
Normal file
69
packages/chezmoi/pass-no-unlock.patch
Normal file
@ -0,0 +1,69 @@
|
||||
diff -u -r ../chezmoi-1.8.4/cmd/secretpass.go ./cmd/secretpass.go
|
||||
--- ../chezmoi-1.8.4/cmd/secretpass.go 2020-08-12 13:38:36.000000000 +0200
|
||||
+++ ./cmd/secretpass.go 2020-08-16 11:55:53.549406216 +0200
|
||||
@@ -3,6 +3,7 @@
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
+ "os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -18,8 +19,7 @@
|
||||
}
|
||||
|
||||
type passCmdConfig struct {
|
||||
- Command string
|
||||
- unlocked bool
|
||||
+ Command string
|
||||
}
|
||||
|
||||
var passCache = make(map[string]string)
|
||||
@@ -40,19 +40,10 @@
|
||||
return s
|
||||
}
|
||||
name := c.Pass.Command
|
||||
- if !c.Pass.unlocked {
|
||||
- args := []string{"grep", "$^"}
|
||||
- cmd := exec.Command(name, args...)
|
||||
- cmd.Stdin = c.Stdin
|
||||
- cmd.Stdout = c.Stdout
|
||||
- cmd.Stderr = c.Stderr
|
||||
- if err := cmd.Run(); err != nil {
|
||||
- panic(fmt.Errorf("%s %s: %w", name, chezmoi.ShellQuoteArgs(args), err))
|
||||
- }
|
||||
- c.Pass.unlocked = true
|
||||
- }
|
||||
args := []string{"show", id}
|
||||
cmd := exec.Command(name, args...)
|
||||
+ cmd.Stdin = os.Stdin
|
||||
+ cmd.Stderr = os.Stderr
|
||||
output, err := c.mutator.IdempotentCmdOutput(cmd)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("%s %s: %w", name, chezmoi.ShellQuoteArgs(args), err))
|
||||
diff -u -r ../chezmoi-1.8.4/testdata/scripts/secretpass.txt ./testdata/scripts/secretpass.txt
|
||||
--- ../chezmoi-1.8.4/testdata/scripts/secretpass.txt 2020-08-12 13:38:36.000000000 +0200
|
||||
+++ ./testdata/scripts/secretpass.txt 2020-08-16 11:58:00.293406125 +0200
|
||||
@@ -8,8 +8,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$*" in
|
||||
-"grep $^")
|
||||
- ;;
|
||||
"show misc/example.com")
|
||||
echo "examplepassword"
|
||||
;;
|
||||
@@ -19,12 +17,7 @@
|
||||
esac
|
||||
-- bin/pass.cmd --
|
||||
@echo off
|
||||
-REM Matching "grep $^" seems more or less impossible on windows as it
|
||||
-REM is an escape character in the cmd.exe shell. See
|
||||
-REM https://github.com/twpayne/chezmoi/pull/839#issuecomment-670800462
|
||||
-IF "%*" == "grep $" (
|
||||
- exit /b 0
|
||||
-) ELSE IF "%*" == "show misc/example.com" (
|
||||
+IF "%*" == "show misc/example.com" (
|
||||
echo | set /p=examplepassword
|
||||
exit /b 0
|
||||
) ELSE (
|
Loading…
Reference in New Issue
Block a user