HEX
Server: nginx/1.29.3
System: Linux 11979.bigscoots-wpo.com 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64
User: nginx (1068)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_open,proc_close,popen,show_source,cmd# Do not modify this line # 1684243876
Upload Files
File: //bigscoots/dedicated/leapp_prep.sh
#!/bin/bash

# Function to get the new interface name
get_new_name() {
    local old_name=$1
    udevadm test-builtin net_id /sys/class/net/$old_name 2>/dev/null | grep -oP 'ID_NET_NAME_ONBOARD=\K\w+'
}

# Get new names for the interfaces
new_name_eth0=$(get_new_name "eth0")
new_name_eth1=$(get_new_name "eth1")

# Backup the current ifcfg files
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.bak
cp /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth1.bak

# Rename the ifcfg files
mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-$new_name_eth0
mv /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-$new_name_eth1

# Update the DEVICE line in the ifcfg files
sed -i "s/DEVICE=eth0/DEVICE=$new_name_eth0/" /etc/sysconfig/network-scripts/ifcfg-$new_name_eth0
sed -i "s/DEVICE=eth1/DEVICE=$new_name_eth1/" /etc/sysconfig/network-scripts/ifcfg-$new_name_eth1

# Optional: Display the changes
echo "Renamed and updated /etc/sysconfig/network-scripts/ifcfg-eth0 to ifcfg-$new_name_eth0 with DEVICE=$new_name_eth0"
echo "Renamed and updated /etc/sysconfig/network-scripts/ifcfg-eth1 to ifcfg-$new_name_eth1 with DEVICE=$new_name_eth1"

# Remove net.ifnames=0 from GRUB_CMDLINE_LINUX in /etc/default/grub
sed -i 's/net.ifnames=0//' /etc/default/grub

# Rebuild the GRUB configuration
grub2-mkconfig -o /boot/grub2/grub.cfg

# Notify user to reboot
echo "Please reboot the system to apply changes."