From 280aee5ff60c4207068beff2f5d19cdb92763c7c Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 05:52:37 +0300 Subject: [PATCH 01/36] move from `sh` to `bash` and beautify --- sudo-touchid.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 83fa426..5ea7d68 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash VERSION=0.2 @@ -6,8 +6,9 @@ sudo_touchid_disable() { local touch_pam='auth sufficient pam_tid.so' local sudo_path='/etc/pam.d/sudo' - if grep -e "^$touch_pam$" "$sudo_path" &> /dev/null; then - echo "The following will be your $sudo_path after disabling:\n" + if grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then + echo "The following will be your $sudo_path after disabling:" + printf '\n' grep -v "^$touch_pam$" "$sudo_path" echo read -p "Are you sure? [y] to confirm " -n 1 -r @@ -15,7 +16,7 @@ sudo_touchid_disable() { if [[ $REPLY =~ ^[Yy]$ ]]; then sudo sed -i '.bak' -e "/^$touch_pam$/d" "$sudo_path" fi - else + else echo "TouchID for sudo seems not to be enabled" fi } @@ -26,19 +27,18 @@ sudo_touchid() { for opt in "${@}"; do case "$opt" in - -V|--version) - echo "$VERSION" - return 0 + -V | --version) + echo "$VERSION" + return 0 ;; - -D|--disable) - sudo_touchid_disable - return 0 + -D | --disable) + sudo_touchid_disable + return 0 ;; esac done - grep -e "^$touch_pam$" "$sudo_path" &> /dev/null - if [ $? -ne 0 ]; then + if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then sudo sed -E -i '.bak' "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" fi } From 671d40f2839b1745aa6253e44cb81621c022d0fc Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 06:02:53 +0300 Subject: [PATCH 02/36] exclude variables, exclude enable() method --- sudo-touchid.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 5ea7d68..88ceacd 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -2,10 +2,10 @@ VERSION=0.2 -sudo_touchid_disable() { - local touch_pam='auth sufficient pam_tid.so' - local sudo_path='/etc/pam.d/sudo' +touch_pam='auth sufficient pam_tid.so' +sudo_path='/etc/pam.d/sudo' +sudo_touchid_disable() { if grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then echo "The following will be your $sudo_path after disabling:" printf '\n' @@ -21,10 +21,13 @@ sudo_touchid_disable() { fi } -sudo_touchid() { - local touch_pam='auth sufficient pam_tid.so' - local sudo_path='/etc/pam.d/sudo' +sudo_touchid_enable() { + if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then + sudo sed -E -i '.bak' "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" + fi +} +sudo_touchid() { for opt in "${@}"; do case "$opt" in -V | --version) @@ -38,8 +41,7 @@ sudo_touchid() { esac done - if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then - sudo sed -E -i '.bak' "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" - fi + sudo_touchid_enable } + sudo_touchid "${@}" From e22ef9d980b300dbadb9e3cc5511eb2fcefabeed Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 06:09:27 +0300 Subject: [PATCH 03/36] add wait_for_user() for --disable --- sudo-touchid.sh | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 88ceacd..37afdac 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -5,17 +5,33 @@ VERSION=0.2 touch_pam='auth sufficient pam_tid.so' sudo_path='/etc/pam.d/sudo' +# Source: https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh +getc() { + local save_state + save_state="$(/bin/stty -g)" + /bin/stty raw -echo + IFS='' read -r -n 1 -d '' "$@" + /bin/stty "${save_state}" +} +wait_for_user() { + local c + echo + echo "Press RETURN to continue or any other key to abort" + getc c + # we test for \r and \n because some stuff does \r instead + if ! [[ "${c}" == $'\r' || "${c}" == $'\n' ]]; then + exit 1 + fi +} +# Source end. + sudo_touchid_disable() { if grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then echo "The following will be your $sudo_path after disabling:" printf '\n' grep -v "^$touch_pam$" "$sudo_path" - echo - read -p "Are you sure? [y] to confirm " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - sudo sed -i '.bak' -e "/^$touch_pam$/d" "$sudo_path" - fi + wait_for_user + sudo sed -i '.bak' -e "/^$touch_pam$/d" "$sudo_path" else echo "TouchID for sudo seems not to be enabled" fi From 04d53ed7ae7395d523b40d205badeadcbb19827b Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 06:19:00 +0300 Subject: [PATCH 04/36] add echo output for all actions --- sudo-touchid.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 37afdac..af69172 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -1,6 +1,7 @@ #!/bin/bash VERSION=0.2 +readable_name='[TouchID for sudo]' touch_pam='auth sufficient pam_tid.so' sudo_path='/etc/pam.d/sudo' @@ -32,14 +33,18 @@ sudo_touchid_disable() { grep -v "^$touch_pam$" "$sudo_path" wait_for_user sudo sed -i '.bak' -e "/^$touch_pam$/d" "$sudo_path" + echo "$readable_name has been disabled." else - echo "TouchID for sudo seems not to be enabled" + echo "$readable_name seems to be already disabled" fi } sudo_touchid_enable() { if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then + echo "$readable_name enabled successfully." sudo sed -E -i '.bak' "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" + else + echo "$readable_name seems to be enabled already" fi } From f944cd3ca6f848e081d3b8dad806fcfa0d587c4e Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 06:22:54 +0300 Subject: [PATCH 05/36] update version --- sudo-touchid.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index af69172..e4e460b 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION=0.2 +VERSION=0.3 readable_name='[TouchID for sudo]' touch_pam='auth sufficient pam_tid.so' From e3cee0a73d813e6e61a5593cd804119c2213594d Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 20:51:43 +0300 Subject: [PATCH 06/36] make newline easier to read --- sudo-touchid.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index e4e460b..abf5c3f 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -29,7 +29,7 @@ wait_for_user() { sudo_touchid_disable() { if grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then echo "The following will be your $sudo_path after disabling:" - printf '\n' + echo grep -v "^$touch_pam$" "$sudo_path" wait_for_user sudo sed -i '.bak' -e "/^$touch_pam$/d" "$sudo_path" From 92c6560d2fe8c6643989d58e52d8636ae9fdb7a1 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 20:53:13 +0300 Subject: [PATCH 07/36] Add "Unknown option" message --- sudo-touchid.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index abf5c3f..da85422 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -59,6 +59,10 @@ sudo_touchid() { sudo_touchid_disable return 0 ;; + *) + echo "$readable_name Unknown option: $opt" + return 0 + ;; esac done From 6df5d3cb4a997a2a95f729ce1f3183d80425c948 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 20:58:19 +0300 Subject: [PATCH 08/36] display success message only after success --- sudo-touchid.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index da85422..3a2b70a 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -41,8 +41,8 @@ sudo_touchid_disable() { sudo_touchid_enable() { if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then - echo "$readable_name enabled successfully." sudo sed -E -i '.bak' "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" + echo "$readable_name enabled successfully." else echo "$readable_name seems to be enabled already" fi From 87e2b95dc1a77b937ed9567c14568d7a9ce6858f Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 21:03:08 +0300 Subject: [PATCH 09/36] add `backup_ext` variable --- sudo-touchid.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 3a2b70a..6a3bad4 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -2,6 +2,7 @@ VERSION=0.3 readable_name='[TouchID for sudo]' +backup_ext='.bak' touch_pam='auth sufficient pam_tid.so' sudo_path='/etc/pam.d/sudo' @@ -32,7 +33,7 @@ sudo_touchid_disable() { echo grep -v "^$touch_pam$" "$sudo_path" wait_for_user - sudo sed -i '.bak' -e "/^$touch_pam$/d" "$sudo_path" + sudo sed -i "$backup_ext" -e "/^$touch_pam$/d" "$sudo_path" echo "$readable_name has been disabled." else echo "$readable_name seems to be already disabled" @@ -41,7 +42,7 @@ sudo_touchid_disable() { sudo_touchid_enable() { if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then - sudo sed -E -i '.bak' "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" + sudo sed -E -i "$backup_ext" "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" echo "$readable_name enabled successfully." else echo "$readable_name seems to be enabled already" From b5a8b06fa16029519a7e4be70c402f840c40bf9c Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 21:12:48 +0300 Subject: [PATCH 10/36] check for success properly, output the outcome status --- sudo-touchid.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 6a3bad4..a9c35cb 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -33,8 +33,11 @@ sudo_touchid_disable() { echo grep -v "^$touch_pam$" "$sudo_path" wait_for_user - sudo sed -i "$backup_ext" -e "/^$touch_pam$/d" "$sudo_path" - echo "$readable_name has been disabled." + if sudo sed -i "$backup_ext" -e "/^$touch_pam$/d" "$sudo_path"; then + echo "$readable_name has been disabled." + else + echo "$readable_name failed to disable" + fi else echo "$readable_name seems to be already disabled" fi @@ -42,8 +45,11 @@ sudo_touchid_disable() { sudo_touchid_enable() { if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then - sudo sed -E -i "$backup_ext" "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" - echo "$readable_name enabled successfully." + if sudo sed -E -i "$backup_ext" "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path"; then + echo "$readable_name enabled successfully." + else + echo "$readable_name failed to execute" + fi else echo "$readable_name seems to be enabled already" fi From 955ceb8982bae928d730ecf12ab5cc8d232ea175 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sat, 6 Nov 2021 21:23:08 +0300 Subject: [PATCH 11/36] exclude sudo_touchid_is_enabled() method --- sudo-touchid.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index a9c35cb..aca950f 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -27,8 +27,12 @@ wait_for_user() { } # Source end. +sudo_touchid_is_enabled() { + grep -e "^$touch_pam$" "$sudo_path" &>/dev/null +} + sudo_touchid_disable() { - if grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then + if sudo_touchid_is_enabled; then echo "The following will be your $sudo_path after disabling:" echo grep -v "^$touch_pam$" "$sudo_path" @@ -44,7 +48,7 @@ sudo_touchid_disable() { } sudo_touchid_enable() { - if ! grep -e "^$touch_pam$" "$sudo_path" &>/dev/null; then + if ! sudo_touchid_is_enabled; then if sudo sed -E -i "$backup_ext" "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path"; then echo "$readable_name enabled successfully." else From 540e5fc4300b6a7107c858a9fdcebba50d0d9d2d Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 16:31:57 +0300 Subject: [PATCH 12/36] make use of grep -q (quiet) flag --- sudo-touchid.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index aca950f..60f1794 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -28,7 +28,7 @@ wait_for_user() { # Source end. sudo_touchid_is_enabled() { - grep -e "^$touch_pam$" "$sudo_path" &>/dev/null + grep -q -e "^$touch_pam$" "$sudo_path" } sudo_touchid_disable() { From 846c22cf7ffa3e1a93be04d99a2c84e72c47c4af Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 16:38:00 +0300 Subject: [PATCH 13/36] improve logic --- sudo-touchid.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 60f1794..4f76479 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -48,14 +48,14 @@ sudo_touchid_disable() { } sudo_touchid_enable() { - if ! sudo_touchid_is_enabled; then + if sudo_touchid_is_enabled; then + echo "$readable_name seems to be enabled already" + else if sudo sed -E -i "$backup_ext" "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path"; then echo "$readable_name enabled successfully." else echo "$readable_name failed to execute" fi - else - echo "$readable_name seems to be enabled already" fi } From 0d6329b2bf70398385647daa474c5441b677868e Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 16:45:52 +0300 Subject: [PATCH 14/36] exclude remove() and insert() methods, change name of is_enabled() --- sudo-touchid.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 4f76479..ae96014 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -27,17 +27,25 @@ wait_for_user() { } # Source end. -sudo_touchid_is_enabled() { +touch_pam_at_sudo_path_check_exists() { grep -q -e "^$touch_pam$" "$sudo_path" } +touch_pam_at_sudo_path_insert() { + sudo sed -E -i "$backup_ext" "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path" +} + +touch_pam_at_sudo_path_remove() { + sudo sed -i "$backup_ext" -e "/^$touch_pam$/d" "$sudo_path" +} + sudo_touchid_disable() { - if sudo_touchid_is_enabled; then + if touch_pam_at_sudo_path_check_exists; then echo "The following will be your $sudo_path after disabling:" echo grep -v "^$touch_pam$" "$sudo_path" wait_for_user - if sudo sed -i "$backup_ext" -e "/^$touch_pam$/d" "$sudo_path"; then + if touch_pam_at_sudo_path_remove; then echo "$readable_name has been disabled." else echo "$readable_name failed to disable" @@ -48,10 +56,10 @@ sudo_touchid_disable() { } sudo_touchid_enable() { - if sudo_touchid_is_enabled; then + if touch_pam_at_sudo_path_check_exists; then echo "$readable_name seems to be enabled already" else - if sudo sed -E -i "$backup_ext" "1s/^(#.*)$/\1\n$touch_pam/" "$sudo_path"; then + if touch_pam_at_sudo_path_insert; then echo "$readable_name enabled successfully." else echo "$readable_name failed to execute" From 0b8a24a1f37d3924437d874f209a2c7b14269af0 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 16:47:14 +0300 Subject: [PATCH 15/36] exclude display_sudo_without_touch_pam() --- sudo-touchid.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index ae96014..54b81d3 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -27,6 +27,10 @@ wait_for_user() { } # Source end. +display_sudo_without_touch_pam() { + grep -v "^$touch_pam$" "$sudo_path" +} + touch_pam_at_sudo_path_check_exists() { grep -q -e "^$touch_pam$" "$sudo_path" } @@ -43,7 +47,7 @@ sudo_touchid_disable() { if touch_pam_at_sudo_path_check_exists; then echo "The following will be your $sudo_path after disabling:" echo - grep -v "^$touch_pam$" "$sudo_path" + display_sudo_without_touch_pam wait_for_user if touch_pam_at_sudo_path_remove; then echo "$readable_name has been disabled." From 5f6afe22d77d95a8b4769fd2ae340cb769e96474 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 17:03:04 +0300 Subject: [PATCH 16/36] add display_backup_info() method --- sudo-touchid.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 54b81d3..fff8552 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -27,6 +27,11 @@ wait_for_user() { } # Source end. +display_backup_info() { + echo "Created a backup file at $sudo_path$backup_ext" + echo +} + display_sudo_without_touch_pam() { grep -v "^$touch_pam$" "$sudo_path" } @@ -50,6 +55,7 @@ sudo_touchid_disable() { display_sudo_without_touch_pam wait_for_user if touch_pam_at_sudo_path_remove; then + display_backup_info echo "$readable_name has been disabled." else echo "$readable_name failed to disable" @@ -64,6 +70,7 @@ sudo_touchid_enable() { echo "$readable_name seems to be enabled already" else if touch_pam_at_sudo_path_insert; then + display_backup_info echo "$readable_name enabled successfully." else echo "$readable_name failed to execute" From da6553d0088ffd5bbeca2949f346176eeaced059 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 17:07:08 +0300 Subject: [PATCH 17/36] =?UTF-8?q?make=20-V=20and=20-D=20options=20lowercas?= =?UTF-8?q?ed=20=E2=80=94=20-v,=20-d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sudo-touchid.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index fff8552..03082ef 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -81,11 +81,11 @@ sudo_touchid_enable() { sudo_touchid() { for opt in "${@}"; do case "$opt" in - -V | --version) + -v | --version) echo "$VERSION" return 0 ;; - -D | --disable) + -d | --disable) sudo_touchid_disable return 0 ;; From 1bfedd74fd55da62cad41f70e0c13216fb083720 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 17:07:51 +0300 Subject: [PATCH 18/36] add "v" letter to --version output --- sudo-touchid.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sudo-touchid.sh b/sudo-touchid.sh index 03082ef..aab5659 100755 --- a/sudo-touchid.sh +++ b/sudo-touchid.sh @@ -82,7 +82,7 @@ sudo_touchid() { for opt in "${@}"; do case "$opt" in -v | --version) - echo "$VERSION" + echo "v$VERSION" return 0 ;; -d | --disable) From a721ca1f584d5d26a7d0de8e1f78c92947629799 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 23:47:26 +0300 Subject: [PATCH 19/36] =?UTF-8?q?Add=20link=20to=20`sudo`=20website=20?= =?UTF-8?q?=E2=80=93=20Readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c5392e9..1e5cc42 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ ### sudo-touchid -Permanent [**TouchID**](https://support.apple.com/en-gb/guide/mac-help/mchl16fbf90a/mac) support for `sudo` - +Permanent [**TouchID**](https://support.apple.com/en-gb/guide/mac-help/mchl16fbf90a/mac) support for sudo + ![Preview](res/preview.png) Just type git.io/sudotouchid to go here. - + ## Try it out     without installing @@ -115,6 +115,7 @@ sh <( curl -sL git.io/sudo-touch-id ) -D ### Contributing ##### [PRs](https://github.com/artginzburg/sudo-touchid/pulls) and [Issues](https://github.com/artginzburg/sudo-touchid/issues/new/choose) are much welcome! + If you don't like something โ€” change it or inform the ones willing to help. ### Related From ed90348334853643037bceedac8ccc076b5d2dca Mon Sep 17 00:00:00 2001 From: artginzburg Date: Sun, 7 Nov 2021 23:48:00 +0300 Subject: [PATCH 20/36] change TouchID link from support.apple.com to wikipedia.org - Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e5cc42..295c57b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ### sudo-touchid -Permanent [**TouchID**](https://support.apple.com/en-gb/guide/mac-help/mchl16fbf90a/mac) support for sudo +Permanent [**TouchID**](https://en.wikipedia.org/wiki/Touch_ID) support for sudo ![Preview](res/preview.png) From feac91f5b64ee29cbda200f516c5fca0fe53f16b Mon Sep 17 00:00:00 2001 From: artginzburg Date: Tue, 9 Nov 2021 22:59:12 +0300 Subject: [PATCH 21/36] add easier to read Header section in Readme --- README.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 295c57b..543a332 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ -
- - +Icon -### sudo-touchid +# sudo-touchid -Permanent [**TouchID**](https://en.wikipedia.org/wiki/Touch_ID) support for sudo +[![Downloads](https://img.shields.io/github/downloads/artginzburg/sudo-touchid/total?color=teal)](https://github.com/artginzburg/sudo-touchid/releases) +[![Donate](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-white)](https://github.com/artginzburg/sudo-touchid?sponsor=1) -![Preview](res/preview.png) +
-Just type git.io/sudotouchid to go here. +Permanent [**TouchID**](https://support.apple.com/en-gb/guide/mac-help/mchl16fbf90a/mac) support for `sudo`
@@ -20,6 +19,14 @@ curl -sL git.io/sudo-touch-id | sh > Now entering sudo mode is easier than ever, just like on GitHub โ€” with TouchID in Terminal or whatever you're on. Don't worry, you can also [reverse](#reverse-without-installation) it without installing +
+ +Preview + +Just type git.io/sudotouchid to go here. + +
+ ### Why? Productivity ยท reliability โ€” macOS _updates_ do _reset_ `/etc/pam.d/sudo`, so previously users had to _manually_ edit the file after each upgrade. @@ -28,7 +35,7 @@ This tool was born to automate the process, allowing for TouchID sudo auth to be
-## Install +## Install ### Via [๐Ÿบ Homebrew](https://brew.sh/) From e4b10d5c66c02585b3def3a60059ccece24b2fce Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 00:31:26 +0300 Subject: [PATCH 22/36] make "Recommended" install way more distinguishable --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 543a332..d6ffa0d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This tool was born to automate the process, allowing for TouchID sudo auth to be ## Install -### Via [๐Ÿบ Homebrew](https://brew.sh/) +### Via [๐Ÿบ Homebrew](https://brew.sh/) (Recommended) ```powershell brew install artginzburg/tap/sudo-touchid @@ -52,7 +52,7 @@ sudo brew services start sudo-touchid curl -sL git.io/sudo-touchid | sh ``` -> Performs automated "manual" installation. But `brew install` is still the recommended way. +> Performs automated "manual" installation.
From 388f367c0701b0c72dd7e846b79cc6c15896fe4d Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 00:51:16 +0300 Subject: [PATCH 23/36] Add "Usage" to Readme --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index d6ffa0d..fc8b26c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,16 @@ curl -sL git.io/sudo-touchid | sh
+## Usage + +```ps1 +sudo-touchid [option] + # Running without options adds TouchID parameter to sudo configuration + [-v, --version] # Output installed version + # Commands: + [-d, --disable] # Removes TouchID from sudo config +``` + ## What does it do? #### `sudo-touchid.sh` โ€” the script: From 4766d7ba5818255418dcab0680e7d6efdee95091 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:09:41 +0300 Subject: [PATCH 24/36] make "Try it out" section more readable --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fc8b26c..f0cc7a1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,9 @@ Permanent [**TouchID**](https://support.apple.com/en-gb/guide/mac-help/mchl16fbf curl -sL git.io/sudo-touch-id | sh ``` -> Now entering sudo mode is easier than ever, just like on GitHub โ€” with TouchID in Terminal or whatever you're on. Don't worry, you can also [reverse](#reverse-without-installation) it without installing +Now entering sudo mode is easier than ever, just like on GitHub โ€” with your fingerprint in Terminal or whatever you're on. + +> Don't worry, you can also [reverse](#reverse-without-installation) it without installing
From 692e6c56f24998187e26d0c6a88a57d8e1f56802 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:12:33 +0300 Subject: [PATCH 25/36] Add "Features", add some more to "Why?", move "Why?" lower in Readme --- README.md | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f0cc7a1..33980d7 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,11 @@ Now entering sudo mode is easier than ever, just like on GitHub โ€” with your fi
-### Why? - -Productivity ยท reliability โ€” macOS _updates_ do _reset_ `/etc/pam.d/sudo`, so previously users had to _manually_ edit the file after each upgrade. +## Features -This tool was born to automate the process, allowing for TouchID sudo auth to be **quickly enabled** on a new/clean system. - -
+- Fast +- Reliable +- Written in Bash โ€” no dependencies! ## Install @@ -56,8 +54,6 @@ curl -sL git.io/sudo-touchid | sh > Performs automated "manual" installation. -
- ## Usage ```ps1 @@ -68,6 +64,24 @@ sudo-touchid [option] [-d, --disable] # Removes TouchID from sudo config ``` +
+ +### Why? + +1. Productivity + + macOS _updates_ do _reset_ `/etc/pam.d/sudo`, so previously users had to _manually_ edit the file after each upgrade. + + > This tool was born to automate the process, allowing for TouchID sudo auth to be **quickly enabled** on a new/clean system. + +2. Spreading the technology. + + I bet half of you didn't know. + + > It was there for a long time. + +
+ ## What does it do? #### `sudo-touchid.sh` โ€” the script: From 785cd32500b8ef7ff07425e17fc8edd6601a03a3 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:14:11 +0300 Subject: [PATCH 26/36] add "Result" subheading to the preview --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 33980d7..1a8e493 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ Now entering sudo mode is easier than ever, just like on GitHub โ€” with your fi > Don't worry, you can also [reverse](#reverse-without-installation) it without installing
- + +Result: + Preview Just type git.io/sudotouchid to go here. From 767f7a5984fd4dd526870840526ce61feb54613c Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:18:07 +0300 Subject: [PATCH 27/36] rename "What does it do?" to "How does it work?" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a8e493..02c8ecb 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ sudo-touchid [option]
-## What does it do? +## How does it work? #### `sudo-touchid.sh` โ€” the script: From 12f3dfb58680ac12e43abebc324a50d7a4a0949d Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:24:00 +0300 Subject: [PATCH 28/36] incorp "Reverse without installation" into "Usage" --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 02c8ecb..2685384 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,21 @@ curl -sL git.io/sudo-touchid | sh ## Usage ```ps1 -sudo-touchid [option] +sudo-touchid [options] # Running without options adds TouchID parameter to sudo configuration [-v, --version] # Output installed version # Commands: [-d, --disable] # Removes TouchID from sudo config ``` +if not installed, can be used via `curl` + +```ps1 +sh <( curl -sL git.io/sudo-touch-id ) [options] + # Reliability โ€” check :) + [-d, --disable] # Removes TouchID from sudo config +``` +
### Why? @@ -139,14 +147,6 @@ that is about 6718 times difference.
-### Reverse without installation - -```ps1 -sh <( curl -sL git.io/sudo-touch-id ) -D -``` - -
- ### Contributing ##### [PRs](https://github.com/artginzburg/sudo-touchid/pulls) and [Issues](https://github.com/artginzburg/sudo-touchid/issues/new/choose) are much welcome! From 0ea4ae04aea7e41cb3a71f5522698757fbc6cb74 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:29:36 +0300 Subject: [PATCH 29/36] Fix heading levels in Readme --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2685384..781616f 100644 --- a/README.md +++ b/README.md @@ -147,14 +147,16 @@ that is about 6718 times difference.
-### Contributing +## Contributing ##### [PRs](https://github.com/artginzburg/sudo-touchid/pulls) and [Issues](https://github.com/artginzburg/sudo-touchid/issues/new/choose) are much welcome! If you don't like something โ€” change it or inform the ones willing to help. -### Related +
+ +## Related -#### Disabling password prompt for `sudo` +### Disabling password prompt for `sudo` - Change `%admin ALL=(ALL) ALL` to `%admin ALL=(ALL) NOPASSWD: ALL` in `/etc/sudoers` From 0feaf14cbac2c3d3304afe2f9c0a91912a1a7f9d Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:35:17 +0300 Subject: [PATCH 30/36] Shorter and simpler "Why this?" in Readme --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 781616f..f1cfbfe 100644 --- a/README.md +++ b/README.md @@ -136,14 +136,13 @@ Fast ยท [Reversible](#reverse-without-installation) ยท Reliable > Unlike other solutions, this can be included to your automated system build with `brew install artginzburg/tap/sudo-touchid && sudo brew services start sudo-touchid`. Always working, always up to date with major macOS upgrades! -Also, the script is small, doesn't need any builds, doesn't need XCode. +The script is small, doesn't need any builds, doesn't need XCode. -Take a look at code size comparison of the previously favoured solution to the one you're currently reading: +Code size comparison โ€” previously favoured solution VS. the one you're currently reading: -[![](https://img.shields.io/github/languages/code-size/mattrajca/sudo-touchid?color=critical&label=mattrajca/sudo-touchid%20code%20size)](https://github.com/mattrajca/sudo-touchid) -![](https://img.shields.io/github/languages/code-size/artginzburg/sudo-touchid?color=success&label=artginzburg/sudo-touchid%20code%20size) +[![](https://img.shields.io/github/languages/code-size/mattrajca/sudo-touchid?color=brown&label=mattrajca/sudo-touchid%20โ€”%20code%20size)](https://github.com/mattrajca/sudo-touchid) -that is about 6718 times difference. +![](https://img.shields.io/github/languages/code-size/artginzburg/sudo-touchid?color=teal&label=artginzburg/sudo-touchid%20โ€”%20code%20size)
From adbee188c4708043a5b5b20e5aeb070604597ab4 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:40:18 +0300 Subject: [PATCH 31/36] move "code size comparison" to "Why? - Lightness" --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f1cfbfe..66aeebe 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,16 @@ sh <( curl -sL git.io/sudo-touch-id ) [options] > It was there for a long time. +3. Lightness + + The script is small, doesn't need any builds, doesn't need XCode. + + ##### Code size comparison โ€” previously favoured solution VS. the one you're currently reading: + + [![](https://img.shields.io/github/languages/code-size/mattrajca/sudo-touchid?color=brown&label=mattrajca/sudo-touchid%20โ€”%20code%20size)](https://github.com/mattrajca/sudo-touchid) + + ![](https://img.shields.io/github/languages/code-size/artginzburg/sudo-touchid?color=teal&label=artginzburg/sudo-touchid%20โ€”%20code%20size) +
## How does it work? @@ -136,14 +146,6 @@ Fast ยท [Reversible](#reverse-without-installation) ยท Reliable > Unlike other solutions, this can be included to your automated system build with `brew install artginzburg/tap/sudo-touchid && sudo brew services start sudo-touchid`. Always working, always up to date with major macOS upgrades! -The script is small, doesn't need any builds, doesn't need XCode. - -Code size comparison โ€” previously favoured solution VS. the one you're currently reading: - -[![](https://img.shields.io/github/languages/code-size/mattrajca/sudo-touchid?color=brown&label=mattrajca/sudo-touchid%20โ€”%20code%20size)](https://github.com/mattrajca/sudo-touchid) - -![](https://img.shields.io/github/languages/code-size/artginzburg/sudo-touchid?color=teal&label=artginzburg/sudo-touchid%20โ€”%20code%20size) -
## Contributing From bbf4bdcadd0477060ace6fb9e86f006fda911252 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:46:18 +0300 Subject: [PATCH 32/36] Readme: Put leftover "Why this?" content into "Features" --- README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index 66aeebe..89bc237 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Now entering sudo mode is easier than ever, just like on GitHub โ€” with your fi - Fast - Reliable - Written in Bash โ€” no dependencies! +- Include it to your automated system build โ€” always working, always up to date with major macOS upgrades! ## Install @@ -140,14 +141,6 @@ sh <( curl -sL git.io/sudo-touch-id ) [options]
-### Why this? - -Fast ยท [Reversible](#reverse-without-installation) ยท Reliable - -> Unlike other solutions, this can be included to your automated system build with `brew install artginzburg/tap/sudo-touchid && sudo brew services start sudo-touchid`. Always working, always up to date with major macOS upgrades! - -
- ## Contributing ##### [PRs](https://github.com/artginzburg/sudo-touchid/pulls) and [Issues](https://github.com/artginzburg/sudo-touchid/issues/new/choose) are much welcome! From f7ca0743931468c158a5480f8c3d4c3eb237ac84 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 01:51:41 +0300 Subject: [PATCH 33/36] Readme: rewrite slogan --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89bc237..c9799de 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Permanent [**TouchID**](https://support.apple.com/en-gb/guide/mac-help/mchl16fbf curl -sL git.io/sudo-touch-id | sh ``` -Now entering sudo mode is easier than ever, just like on GitHub โ€” with your fingerprint in Terminal or whatever you're on. +Now sudo is great, just like Safari โ€” with your fingerprint in Terminal or whatever you're on. > Don't worry, you can also [reverse](#reverse-without-installation) it without installing From 30fc5dd49bfbd4344749234d816526f868a38f9b Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 05:13:33 +0300 Subject: [PATCH 34/36] fix spacing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9799de..b734335 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ curl -sL git.io/sudo-touchid | sh ```ps1 sudo-touchid [options] - # Running without options adds TouchID parameter to sudo configuration + # Running without options adds TouchID parameter to sudo configuration [-v, --version] # Output installed version # Commands: [-d, --disable] # Removes TouchID from sudo config From 450be7f0283b6c989acfe153dcfb3c83b34ce54d Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 05:16:53 +0300 Subject: [PATCH 35/36] fix a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b734335..f64f2e9 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ sh <( curl -sL git.io/sudo-touch-id ) [options] - Creates a backup file named `sudo.bak`. -- Has a `--disable` (`-D`) option that performs the opposite of the steps above. +- Has a `--disable` (`-d`) option that performs the opposite of the steps above.
Non-Homebrew files: From c841c76d1be504788e280092d76f49f30ad02830 Mon Sep 17 00:00:00 2001 From: artginzburg Date: Wed, 10 Nov 2021 05:18:10 +0300 Subject: [PATCH 36/36] Readme: fix anchor in header --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f64f2e9..095958a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ curl -sL git.io/sudo-touch-id | sh Now sudo is great, just like Safari โ€” with your fingerprint in Terminal or whatever you're on. -> Don't worry, you can also [reverse](#reverse-without-installation) it without installing +> Don't worry, you can also [reverse](#usage) it without installing