dracut-systemd/dracut-initqueue: only start service if really needed
[dracut.git] / modules.d / 95cifs / cifs-lib.sh
blob8e192041f58779740ed94571b88b0cb409a24c81
1 #!/bin/sh
3 # cifs_to_var CIFSROOT
4 # use CIFSROOT to set $server, $path, and $options.
5 # CIFSROOT is something like: cifs://[<username>[:<password>]]@<host>/<path>
6 # NETIF is used to get information from DHCP options, if needed.
8 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
10 cifs_to_var() {
11 local cifsuser; local cifspass
12 # Check required arguments
13 server=${1##cifs://}
14 cifsuser=${server%@*}
15 cifspass=${cifsuser#*:}
16 if [ "$cifspass" != "$cifsuser" ]; then
17 cifsuser=${cifsuser%:*}
18 else
19 cifspass=$(getarg cifspass)
21 if [ "$cifsuser" != "$server" ]; then
22 server="${server#*@}"
23 else
24 cifsuser=$(getarg cifsuser)
27 path=${server#*/}
28 server=${server%/*}
30 if [ ! "$cifsuser" -o ! "$cifspass" ]; then
31 die "For CIFS support you need to specify a cifsuser and cifspass either in the cifsuser and cifspass commandline parameters or in the root= CIFS URL."
33 options="user=$cifsuser,pass=$cifspass"