summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Horák <dan@danny.cz>2020-10-07 14:56:08 +0200
committerDan Horák <dan@danny.cz>2020-10-07 14:56:08 +0200
commit6f264c2a4279fa9616f2450f09fcc93bd4c2b7c6 (patch)
treeb52c936b38b1cc9c344f80e54d4ae8f8d4d59c94
parentbfe9fa1770f245abd8fa70c56712d8da3600af93 (diff)
downloadutils-6f264c2a4279fa9616f2450f09fcc93bd4c2b7c6.tar.gz
utils-6f264c2a4279fa9616f2450f09fcc93bd4c2b7c6.tar.xz
utils-6f264c2a4279fa9616f2450f09fcc93bd4c2b7c6.zip
update ccw_init and device_cio_free for new NetworkManager default
update scripts for https://fedoraproject.org/wiki/Changes/NetworkManager_keyfile_instead_of_ifcfg_rh that will be implemented in Fedora 33. In addition to ifcfg files we must look at the NM keyfiles too. New systems will use keyfiles only, but upgraded systems use ifcfg still.
-rw-r--r--ccw_init17
-rw-r--r--device_cio_free8
2 files changed, 24 insertions, 1 deletions
diff --git a/ccw_init b/ccw_init
index 23e8ed9..3703eaf 100644
--- a/ccw_init
+++ b/ccw_init
@@ -35,6 +35,14 @@ get_config_by_subchannel ()
| LC_ALL=C sed -e "$__sed_discard_ignored_files"
}
+get_config_by_subchannel_nm ()
+{
+ LANG=C grep -E -i -l \
+ "^s390-subchannels=([0-9]\.[0-9]\.[a-f0-9]+;){0,2}${1};([0-9]\.[0-9]\.[a-f0-9]+;){0,2}$" \
+ /etc/NetworkManager/system-connections/*.nmconnection \
+ | LC_ALL=C sed -e "$__sed_discard_ignored_files"
+}
+
CHANNEL=${DEVPATH##*/}
if [ $MODE = "dracut" ]; then
@@ -65,7 +73,14 @@ elif [ $MODE = "normal" ]; then
if [ -n "$CONFIG_FILE" ]; then
. $CONFIG_FILE
else
- exit 1
+ CONFIG_FILE=$(get_config_by_subchannel_nm $CHANNEL)
+ if [ -n "$CONFIG_FILE" ]; then
+ NETTYPE=$(sed -nr "/^\[ethernet\]/ { :l /^s390-nettype[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE)
+ SUBCHANNELS=$(sed -nr "/^\[ethernet\]/ { :l /^s390-subchannels[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE | sed -e "s/;/,/g" -e "s/,$//")
+ LAYER2=$(sed -nr "/^\[ethernet-s390-options\]/ { :l /^layer2[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE)
+ else
+ exit 1
+ fi
fi
else
echo "Unknown mode=$MODE"
diff --git a/device_cio_free b/device_cio_free
index cd2b21f..cfdced0 100644
--- a/device_cio_free
+++ b/device_cio_free
@@ -306,6 +306,14 @@ if [ $MODE_ZNET ]; then
eval "$line"
free_device $SUBCHANNELS
done
+ for line in $(LANG=C grep -E -i -h \
+ "^s390-subchannels=([0-9]\.[0-9]\.[a-f0-9]+;){2,3}$" \
+ $( (ls /etc/NetworkManager/system-connections/*.nmconnection 2> /dev/null || echo "__no_config_file") | \
+ LC_ALL=C sed -e "$__sed_discard_ignored_files") 2> /dev/null)
+ do
+ SUBCHANNELS="$(echo $line | sed -e "s/s390-subchannels=//" -e "s/;/,/g")"
+ free_device $SUBCHANNELS
+ done
fi
[ -z "$ALL_DEVICES" ] && exit 0