Browse Source

fix: shellcheck for modules.d/95ssh-client/module-setup.sh

master
Harald Hoyer 4 years ago committed by Harald Hoyer
parent
commit
a1b3c13e3a
  1. 16
      modules.d/95ssh-client/module-setup.sh

16
modules.d/95ssh-client/module-setup.sh

@ -10,7 +10,7 @@ check() {
require_binaries ssh scp || return 1 require_binaries ssh scp || return 1


if [[ $sshkey ]]; then if [[ $sshkey ]]; then
[ ! -f $dracutsysrootdir$sshkey ] && { [[ ! -f $dracutsysrootdir$sshkey ]] && {
derror "ssh key: $sshkey is not found!" derror "ssh key: $sshkey is not found!"
return 1 return 1
} }
@ -27,14 +27,14 @@ depends() {


inst_sshenv() inst_sshenv()
{ {
if [ -d $dracutsysrootdir/root/.ssh ]; then if [[ -d $dracutsysrootdir/root/.ssh ]]; then
inst_dir /root/.ssh inst_dir /root/.ssh
chmod 700 ${initdir}/root/.ssh chmod 700 "${initdir}"/root/.ssh
fi fi


# Copy over ssh key and knowhosts if needed # Copy over ssh key and knowhosts if needed
[[ $sshkey ]] && { [[ $sshkey ]] && {
inst_simple $sshkey inst_simple "$sshkey"
[[ -f $dracutsysrootdir/root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts [[ -f $dracutsysrootdir/root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
[[ -f $dracutsysrootdir/etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts [[ -f $dracutsysrootdir/etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
} }
@ -43,8 +43,8 @@ inst_sshenv()
[[ -f $dracutsysrootdir/root/.ssh/config ]] && inst_simple /root/.ssh/config [[ -f $dracutsysrootdir/root/.ssh/config ]] && inst_simple /root/.ssh/config
if [[ -f $dracutsysrootdir/etc/ssh/ssh_config ]]; then if [[ -f $dracutsysrootdir/etc/ssh/ssh_config ]]; then
inst_simple /etc/ssh/ssh_config inst_simple /etc/ssh/ssh_config
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' "${initdir}"/etc/ssh/ssh_config
while read key val || [ -n "$key" ]; do while read -r key val || [ -n "$key" ]; do
if [[ $key == "GlobalKnownHostsFile" ]]; then if [[ $key == "GlobalKnownHostsFile" ]]; then
inst_simple "$val" inst_simple "$val"
# Copy customized UserKnowHostsFile # Copy customized UserKnowHostsFile
@ -55,7 +55,7 @@ inst_sshenv()
fi fi
inst_simple "$val" inst_simple "$val"
fi fi
done < $dracutsysrootdir/etc/ssh/ssh_config done < "$dracutsysrootdir"/etc/ssh/ssh_config
fi fi


return 0 return 0
@ -70,7 +70,7 @@ install() {


_nsslibs=$( _nsslibs=$(
sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \ sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
$dracutsysrootdir/etc/nsswitch.conf \ "$dracutsysrootdir"/etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|') | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_nsslibs=${_nsslibs#|} _nsslibs=${_nsslibs#|}
_nsslibs=${_nsslibs%|} _nsslibs=${_nsslibs%|}

Loading…
Cancel
Save