do not set UUID
+ other fixes
This commit is contained in:
10
install.py
10
install.py
@ -10,7 +10,7 @@ import shutil
|
||||
from glob import glob
|
||||
from ipaddress import IPv4Interface
|
||||
from configparser import ConfigParser
|
||||
from os.path import join, getmtime, exists
|
||||
from os.path import join, getmtime, exists, basename
|
||||
|
||||
os.chdir('/root/aputools/to_system')
|
||||
|
||||
@ -41,7 +41,6 @@ def create_if(name, cfg, mac):
|
||||
PROXY_METHOD='none',
|
||||
BROWSER_ONLY='no',
|
||||
IPV4_FAILURE_FATAL='yes',
|
||||
UUID='58d61ced-05d2-4726-a8f7-%s' % ''.join(mac.split(':')),
|
||||
IPV6INIT='no')
|
||||
if cfg == 'off':
|
||||
result['ONBOOT']='no'
|
||||
@ -154,7 +153,7 @@ def network(doit):
|
||||
for ntry in range(1 + bool(doit)):
|
||||
with open('/etc/hostname') as f:
|
||||
hostname = f.read().strip()
|
||||
if hostname == cfgfile[:-7]: # stripped apuid from cfgfile
|
||||
if cfgfile == CFGPATH % ('%s_%6.6x' % (hostname, apuid)):
|
||||
break
|
||||
if doit:
|
||||
if ntry == 0:
|
||||
@ -163,7 +162,9 @@ def network(doit):
|
||||
print('ERROR: can not set host name')
|
||||
return False
|
||||
else:
|
||||
print('host name does not match')
|
||||
if cfgfile:
|
||||
print('host name does not match %r -> %r' % (hostname, basename(cfgfile).rpartition('_')[0]))
|
||||
show.dirty = True
|
||||
break
|
||||
if cfgfile is None:
|
||||
return False
|
||||
@ -178,6 +179,7 @@ def network(doit):
|
||||
todo = write_when_new('/etc/sysconfig/network-scripts/ifcfg-%s' % ifname, content, doit)
|
||||
if todo:
|
||||
print('change ', ifname)
|
||||
show.dirty = True
|
||||
except Exception as e:
|
||||
print('ERROR: can not handle %s %s: %r' % (hostname, ifname, e))
|
||||
return False
|
||||
|
@ -1,9 +1,9 @@
|
||||
[NETWORK]
|
||||
address=00:0d:b9:59:1f:ac
|
||||
enp1s0=dhcp
|
||||
enp1s0=192.168.127.1/24
|
||||
enp2s0=192.168.2.1/24
|
||||
enp3s0=192.168.3.1/24
|
||||
enp4s0=192.168.127.1/24
|
||||
enp4s0=dhcp
|
||||
|
||||
[ROUTER]
|
||||
3000=/dev/ttyUSB0
|
||||
|
@ -1,10 +1,14 @@
|
||||
ETHNAME=$(cat /sys/class/net/enp1s0/address)
|
||||
FOUND=$(grep -H address=$ETHNAME /root/aputools/servercfg/*.cfg)
|
||||
ETHNAME=${ETHNAME//:/}
|
||||
APUID=${ETHNAME: -6}
|
||||
FOUND=( /root/aputools/servercfg/*_$APUID.cfg )
|
||||
if [ -z "$FOUND" ]; then
|
||||
ETHNAME=${ETHNAME//:/}
|
||||
HOSTNAME=apu${ETHNAME:6:6}
|
||||
HOSTNAME=apu$APUID
|
||||
else
|
||||
FOUND=$(basename $FOUND) # remove directory part
|
||||
HOSTNAME=${FOUND%%.*} # remove extension and all the rest
|
||||
FOUND=$(basename ${FOUND[0]}) # remove directory part
|
||||
HOSTNAME=${FOUND%%.*} # remove extension
|
||||
if [ $HOSTNAME != "apu$APUID" ]; then
|
||||
HOSTNAME=${HOSTNAME%_*}
|
||||
fi
|
||||
fi
|
||||
echo $HOSTNAME > /etc/hostname
|
||||
|
@ -1,8 +0,0 @@
|
||||
TYPE=Ethernet
|
||||
NAME=enp1s0
|
||||
DEVICE=enp1s0
|
||||
BOOTPROTO=none
|
||||
ONBOOT=yes
|
||||
IPADDR=192.168.2.1
|
||||
NETMASK=255.255.255.0
|
||||
PREFIX=24
|
@ -1,8 +0,0 @@
|
||||
TYPE=Ethernet
|
||||
NAME=enp2s0
|
||||
DEVICE=enp2s0
|
||||
BOOTPROTO=none
|
||||
ONBOOT=yes
|
||||
IPADDR=192.168.2.2
|
||||
NETMASK=255.255.255.0
|
||||
PREFIX=24
|
@ -1,8 +0,0 @@
|
||||
TYPE=Ethernet
|
||||
NAME=enp3s0
|
||||
DEVICE=enp3s0
|
||||
BOOTPROTO=none
|
||||
ONBOOT=yes
|
||||
IPADDR=192.168.2.3
|
||||
NETMASK=255.255.255.0
|
||||
PREFIX=24
|
@ -1,5 +0,0 @@
|
||||
TYPE=Ethernet
|
||||
NAME=enp4s0
|
||||
DEVICE=enp4s0
|
||||
BOOTPROTO=dhcp
|
||||
ONBOOT=yes
|
Reference in New Issue
Block a user