network: don't use "ifup -m"
[dracut.git] / modules.d / 95ssh-client / module-setup.sh
blob0a0e80cd9887a8dc9f96667d711031b948cac8b7
1 #!/bin/bash
3 # fixme: assume user is root
5 # called by dracut
6 check() {
7 [[ $mount_needs ]] && return 1
9 # If our prerequisites are not met, fail.
10 require_binaries ssh scp || return 1
12 if [[ $sshkey ]]; then
13 [ ! -f $sshkey ] && {
14 derror "ssh key: $sshkey is not found!"
15 return 1
19 return 255
22 # called by dracut
23 depends() {
24 # We depend on network modules being loaded
25 echo network
28 inst_sshenv()
30 if [ -d /root/.ssh ]; then
31 inst_dir /root/.ssh
32 chmod 700 ${initdir}/root/.ssh
35 # Copy over ssh key and knowhosts if needed
36 [[ $sshkey ]] && {
37 inst_simple $sshkey
38 [[ -f /root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
39 [[ -f /etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
42 # Copy over root and system-wide ssh configs.
43 [[ -f /root/.ssh/config ]] && inst_simple /root/.ssh/config
44 if [[ -f /etc/ssh/ssh_config ]]; then
45 inst_simple /etc/ssh/ssh_config
46 sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
47 while read key val || [ -n "$key" ]; do
48 [[ $key != "GlobalKnownHostsFile" ]] && continue
49 inst_simple "$val"
50 break
51 done < /etc/ssh/ssh_config
54 return 0
57 # called by dracut
58 install() {
59 inst_multiple ssh scp
60 inst_sshenv