diff --git a/kura/distrib/src/main/resources/generic-aarch64/deb/control/prerm b/kura/distrib/src/main/resources/generic-aarch64/deb/control/prerm index 2dc8d0bc555..4df1fff7c16 100644 --- a/kura/distrib/src/main/resources/generic-aarch64/deb/control/prerm +++ b/kura/distrib/src/main/resources/generic-aarch64/deb/control/prerm @@ -61,6 +61,27 @@ function stopWatchdog { fi } +function restore_backup_files { + SUFFIX="${1}" + + shift + + for file in "${@}" + do + if [ -f "${file}" ] && expr "${file}" : ".*[.]${SUFFIX}$" > /dev/null; then + mv "${file}" "${file%."${SUFFIX}"}" + fi + done +} + +function restore_netplan { + if [ -f /etc/netplan/zz-kura-use-nm.yaml ]; then + rm -f /etc/netplan/zz-kura-use-nm.yaml + fi + + restore_backup_files kurasave /lib/netplan/* /etc/netplan/* +} + # Pre-remove script function preRemove { #Remove INIT scripts @@ -107,6 +128,8 @@ function preRemove { if [ -f /etc/default/dnsmasq.old ]; then mv /etc/default/dnsmasq.old /etc/default/dnsmasq fi + + restore_netplan echo "" echo "Uninstalling KURA... Done!" diff --git a/kura/distrib/src/main/resources/generic-aarch64/kura_install.sh b/kura/distrib/src/main/resources/generic-aarch64/kura_install.sh index 7d200e42782..6c6e395623e 100755 --- a/kura/distrib/src/main/resources/generic-aarch64/kura_install.sh +++ b/kura/distrib/src/main/resources/generic-aarch64/kura_install.sh @@ -12,6 +12,36 @@ # Eurotech # +backup_files() { + SUFFIX="${1}" + + shift + + for file in "${@}" + do + if [ -f "${file}" ] + then + mv "${file}" "${file}.${SUFFIX}" + fi + done +} + +disable_netplan() { + # disable netplan configuration files + backup_files kurasave /lib/netplan/*.yaml /etc/netplan/*.yaml + + if [ -d /etc/netplan ] + then + + # use NM renderer + cat > /etc/netplan/zz-kura-use-nm.yaml < /dev/null fi -if [ -d /etc/netplan/ ]; then - cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.BAK - cat << EOF >> /etc/netplan/00-installer-config.yaml -# This file describes the network interfaces available on your system -# For more information, see netplan(5). -network: - version: 2 - renderer: NetworkManager -EOF -fi + +disable_netplan + if [ -d /usr/lib/NetworkManager/conf.d/ ]; then TO_REMOVE=$( find /usr/lib/NetworkManager/conf.d/ -type f -name "*-globally-managed-devices.conf" | awk 'NR==1{print $1}' ) diff --git a/kura/distrib/src/main/resources/generic-arm32/deb/control/prerm b/kura/distrib/src/main/resources/generic-arm32/deb/control/prerm index 2dc8d0bc555..4df1fff7c16 100644 --- a/kura/distrib/src/main/resources/generic-arm32/deb/control/prerm +++ b/kura/distrib/src/main/resources/generic-arm32/deb/control/prerm @@ -61,6 +61,27 @@ function stopWatchdog { fi } +function restore_backup_files { + SUFFIX="${1}" + + shift + + for file in "${@}" + do + if [ -f "${file}" ] && expr "${file}" : ".*[.]${SUFFIX}$" > /dev/null; then + mv "${file}" "${file%."${SUFFIX}"}" + fi + done +} + +function restore_netplan { + if [ -f /etc/netplan/zz-kura-use-nm.yaml ]; then + rm -f /etc/netplan/zz-kura-use-nm.yaml + fi + + restore_backup_files kurasave /lib/netplan/* /etc/netplan/* +} + # Pre-remove script function preRemove { #Remove INIT scripts @@ -107,6 +128,8 @@ function preRemove { if [ -f /etc/default/dnsmasq.old ]; then mv /etc/default/dnsmasq.old /etc/default/dnsmasq fi + + restore_netplan echo "" echo "Uninstalling KURA... Done!" diff --git a/kura/distrib/src/main/resources/generic-arm32/kura_install.sh b/kura/distrib/src/main/resources/generic-arm32/kura_install.sh index 7d200e42782..6c6e395623e 100755 --- a/kura/distrib/src/main/resources/generic-arm32/kura_install.sh +++ b/kura/distrib/src/main/resources/generic-arm32/kura_install.sh @@ -12,6 +12,36 @@ # Eurotech # +backup_files() { + SUFFIX="${1}" + + shift + + for file in "${@}" + do + if [ -f "${file}" ] + then + mv "${file}" "${file}.${SUFFIX}" + fi + done +} + +disable_netplan() { + # disable netplan configuration files + backup_files kurasave /lib/netplan/*.yaml /etc/netplan/*.yaml + + if [ -d /etc/netplan ] + then + + # use NM renderer + cat > /etc/netplan/zz-kura-use-nm.yaml < /dev/null fi -if [ -d /etc/netplan/ ]; then - cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.BAK - cat << EOF >> /etc/netplan/00-installer-config.yaml -# This file describes the network interfaces available on your system -# For more information, see netplan(5). -network: - version: 2 - renderer: NetworkManager -EOF -fi + +disable_netplan + if [ -d /usr/lib/NetworkManager/conf.d/ ]; then TO_REMOVE=$( find /usr/lib/NetworkManager/conf.d/ -type f -name "*-globally-managed-devices.conf" | awk 'NR==1{print $1}' ) diff --git a/kura/distrib/src/main/resources/generic-x86_64/deb/control/prerm b/kura/distrib/src/main/resources/generic-x86_64/deb/control/prerm index 69117f78e19..04d03b256fe 100644 --- a/kura/distrib/src/main/resources/generic-x86_64/deb/control/prerm +++ b/kura/distrib/src/main/resources/generic-x86_64/deb/control/prerm @@ -61,6 +61,27 @@ function stopWatchdog { fi } +function restore_backup_files { + SUFFIX="${1}" + + shift + + for file in "${@}" + do + if [ -f "${file}" ] && expr "${file}" : ".*[.]${SUFFIX}$" > /dev/null; then + mv "${file}" "${file%."${SUFFIX}"}" + fi + done +} + +function restore_netplan { + if [ -f /etc/netplan/zz-kura-use-nm.yaml ]; then + rm -f /etc/netplan/zz-kura-use-nm.yaml + fi + + restore_backup_files kurasave /lib/netplan/* /etc/netplan/* +} + # Pre-remove script function preRemove { #Remove INIT scripts @@ -108,6 +129,8 @@ function preRemove { mv /etc/default/dnsmasq.old /etc/default/dnsmasq fi + restore_netplan + echo "" echo "Uninstalling KURA... Done!" } diff --git a/kura/distrib/src/main/resources/generic-x86_64/kura_install.sh b/kura/distrib/src/main/resources/generic-x86_64/kura_install.sh index 7d200e42782..6c6e395623e 100755 --- a/kura/distrib/src/main/resources/generic-x86_64/kura_install.sh +++ b/kura/distrib/src/main/resources/generic-x86_64/kura_install.sh @@ -12,6 +12,36 @@ # Eurotech # +backup_files() { + SUFFIX="${1}" + + shift + + for file in "${@}" + do + if [ -f "${file}" ] + then + mv "${file}" "${file}.${SUFFIX}" + fi + done +} + +disable_netplan() { + # disable netplan configuration files + backup_files kurasave /lib/netplan/*.yaml /etc/netplan/*.yaml + + if [ -d /etc/netplan ] + then + + # use NM renderer + cat > /etc/netplan/zz-kura-use-nm.yaml < /dev/null fi -if [ -d /etc/netplan/ ]; then - cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.BAK - cat << EOF >> /etc/netplan/00-installer-config.yaml -# This file describes the network interfaces available on your system -# For more information, see netplan(5). -network: - version: 2 - renderer: NetworkManager -EOF -fi + +disable_netplan + if [ -d /usr/lib/NetworkManager/conf.d/ ]; then TO_REMOVE=$( find /usr/lib/NetworkManager/conf.d/ -type f -name "*-globally-managed-devices.conf" | awk 'NR==1{print $1}' )