1 |
commit: a1f719112f02feb8e7c854a5095c7cebb6d0bf4a |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Aug 6 17:17:20 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 6 20:40:32 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a1f71911 |
7 |
|
8 |
login-remote.sh: Make shellcheck happy |
9 |
|
10 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
11 |
|
12 |
defaults/login-remote.sh | 28 ++++++++++++++-------------- |
13 |
1 file changed, 14 insertions(+), 14 deletions(-) |
14 |
|
15 |
diff --git a/defaults/login-remote.sh b/defaults/login-remote.sh |
16 |
index ca85b06..12596b9 100644 |
17 |
--- a/defaults/login-remote.sh |
18 |
+++ b/defaults/login-remote.sh |
19 |
@@ -15,31 +15,31 @@ receivefile() { |
20 |
swap) |
21 |
file=${CRYPT_KEYFILE_SWAP} |
22 |
;; |
23 |
+ '') |
24 |
+ bad_msg "No keyfile specified." "${CRYPT_SILENT}" |
25 |
+ exit 1 |
26 |
+ ;; |
27 |
*) |
28 |
- bad_msg "Unknown '${1}' keyfile received." ${CRYPT_SILENT} |
29 |
+ bad_msg "Unknown '${1}' keyfile received." "${CRYPT_SILENT}" |
30 |
exit 1 |
31 |
;; |
32 |
esac |
33 |
|
34 |
# limit maximum stored bytes to 1M to avoid killing the server |
35 |
- dd of=${file} count=1k bs=1k 2>/dev/null |
36 |
+ run dd of="${file}" count=1k bs=1k 2>/dev/null |
37 |
return $? |
38 |
} |
39 |
|
40 |
- |
41 |
- |
42 |
if [ "x${1}" = "x-c" ] |
43 |
then |
44 |
- command=$(echo ${2} | awk -F" " '{print $1}') |
45 |
- type=$(echo ${2} | awk -F" " '{print $2}') |
46 |
+ command=$(echo "${2}" | awk '{ print $1 }') |
47 |
+ type=$(echo "${2}" | awk '{ print $2 }') |
48 |
|
49 |
case ${command} in |
50 |
post) |
51 |
- receivefile ${type} |
52 |
- if [ $? -eq 0 ] |
53 |
+ if receivefile "${type}" |
54 |
then |
55 |
- unlock-luks ${type} |
56 |
- if [ $? -eq 0 ] |
57 |
+ if unlock-luks "${type}" |
58 |
then |
59 |
if [ "${type}" = 'root' ] |
60 |
then |
61 |
@@ -53,12 +53,12 @@ then |
62 |
exit 1 |
63 |
fi |
64 |
else |
65 |
- bad_msg "Keyfile was not properly received!" ${CRYPT_SILENT} |
66 |
+ bad_msg "Keyfile was not properly received!" "${CRYPT_SILENT}" |
67 |
exit 1 |
68 |
fi |
69 |
;; |
70 |
*) |
71 |
- bad_msg "Command '${command}' is not supported!" ${CRYPT_SILENT} |
72 |
+ bad_msg "Command '${command}' is not supported!" "${CRYPT_SILENT}" |
73 |
exit 1 |
74 |
esac |
75 |
else |
76 |
@@ -77,12 +77,12 @@ else |
77 |
good_msg "${NORMAL}Be aware that it will kill your connection which means" |
78 |
good_msg "${NORMAL}you will no longer be able to work in this shell." |
79 |
|
80 |
- if [ -n "${CRYPT_ROOT}" -a ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] |
81 |
+ if [ -n "${CRYPT_ROOT}" ] && [ ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] |
82 |
then |
83 |
good_msg "${NORMAL}To remote unlock LUKS-encrypted root device, run '${BOLD}unlock-luks root${NORMAL}'." |
84 |
fi |
85 |
|
86 |
- if [ -n "${CRYPT_SWAP}" -a ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] |
87 |
+ if [ -n "${CRYPT_SWAP}" ] && [ ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] |
88 |
then |
89 |
good_msg "${NORMAL}To remote unlock LUKS-encrypted swap device, run '${BOLD}unlock-luks swap${NORMAL}'." |
90 |
fi |