Skip to content

Commit 09db014

Browse files
authored
Merge pull request #10 from derenv/sanity-fix
fixed broken sanity check
2 parents 6413eec + d258a68 commit 09db014

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

bash-kernel-signer.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function sign_kernel()
4343
echo "$prev_out"
4444
echo "=============================================="
4545
echo "0 - Exit"
46-
read -r user_input -p "Which kernel would you like to sign?:"
46+
read -p "Which kernel would you like to sign?:" -r user_input
4747

4848
if [[ "$user_input" == "0" ]]; then
4949
ERROR_MSG="cancelled.."
@@ -89,7 +89,7 @@ function purge_kernel()
8989
echo "$prev_out"
9090
echo "=============================================="
9191
echo "0 - Exit"
92-
read -r user_input -p "Which signed kernel would you like to purge?:"
92+
read -p "Which signed kernel would you like to purge?:" -r user_input
9393

9494
if [[ "$user_input" == "0" ]]; then
9595
ERROR_MSG="cancelled.."
@@ -246,7 +246,7 @@ while [[ "$stop" == "False" ]]; do
246246
echo "5 - Modify Grub"
247247
echo "6 - Reboot"
248248
echo "0 - Exit"
249-
read -r user_input -p "enter input:"
249+
read -p "enter input:" -r user_input
250250

251251
if [[ "$user_input" == "1" ]]; then
252252
if [[ "$valid_keys" == "True" ]]; then
@@ -278,7 +278,8 @@ while [[ "$stop" == "False" ]]; do
278278
fi
279279
elif [[ "$user_input" == "4" ]]; then
280280
# check mainline present
281-
if ! command -v mainline-gtk &> /dev/null; then
281+
command_exists=$(su -c 'command -v mainline-gtk' "$(logname)")
282+
if [[ -n "$command_exists" ]]; then
282283
# redirect to mainline-gtk app
283284
mainline-gtk
284285
if [[ $? == 0 ]]; then
@@ -287,11 +288,12 @@ while [[ "$stop" == "False" ]]; do
287288
prev_out="failure: $?"
288289
fi
289290
else
290-
prev_out="grub-customizer not present!"
291+
prev_out="mainline-gtk not present!"
291292
fi
292293
elif [[ "$user_input" == "5" ]]; then
294+
command_exists=$(su -c 'command -v grub-customizer' "$(logname)")
293295
# check grub-customizer present
294-
if ! command -v grub-customizer &> /dev/null; then
296+
if [[ -n "$command_exists" ]]; then
295297
# redirect to grub-customizer app
296298
grub-customizer
297299
if [[ $? == 0 ]]; then

0 commit comments

Comments
 (0)