]>
Raphaƫl G. Git Repositories - distgen/blob - lib/export.sh
4 cat /dev
/null
> root.conf
6 # Append every config parameters
7 for i
in `cat config/*.conf | perl -pne 'undef $_ if /^#/; s/=.*$//'`; do
8 echo "$i='$(eval echo \$$i)'" | tee -a root.conf
12 cat << EOF > root/virtualbox
13 # VirtualBox disk creation commands
14 VBoxManage internalcommands createrawvmdk -filename '$VBHDDIR/sda.vmdk' -rawdisk '${PWD}/${SDA}'
15 VBoxManage internalcommands createrawvmdk -filename '$VBHDDIR/sdb.vmdk' -rawdisk '${PWD}/${SDB}'
17 Fix ownership of '${PWD}/${SDA}', '${PWD}/${SDB}', '${VBHDDIR}/sda.vmdk' and '${VBHDDIR}/sdb.vmdk' if you to use these as user
19 # VirtualBox configuration
20 Go in file/preferences.../network/host-only networks" >> root.virtualbox
21 Add a new host-only networkd IPv4=${NETGATEWAY4}/IPv4 Mask=255.255.255.0/IPv6=${NETGATEWAY6}/IPv6 Mask=64/DHCP Server=disabled" >> root.virtualbox
23 # Virtual Machine Configuration
24 Create a new virtual machine : Type=Linux/Version=Mageia(${ARCH})/Do not add a virtual hard disk
25 Open the settings of the virtual machine
28 In controller SATA click on add hard disk, select choose existing disk, sda.vmdk, same with sdb.vmdk
31 Change 'Attached to' to 'Host-only adapter'
32 Under advanced change MAC Address to ${NETMAC}
36 NETADDRESS4F
=$(perl -e 'use Socket qw(AF_INET inet_ntop inet_pton); my
($ip, $mask) = @ARGV
; print Socket
::inet_ntop
(Socket
::AF_INET
, pack
("N", unpack
("N", Socket
::inet_pton
(Socket
::AF_INET
, $ip)) & (2**$mask-1)<<(32-$mask)))' ${NETADDRESS4%/*} ${NETADDRESS4#*/})
37 NETADDRESS4M=$(perl -e 'my ($ip, $mask) = @ARGV; print join(".", unpack("C4", pack("N", (2**$mask-1)<<(32-$mask))))' ${NETADDRESS4%/*} ${NETADDRESS4#*/})
38 cat << EOF > root/dhcpd.conf
40 ddns-update-style none;
43 option domain-name "${NETHOSTNAME#*.}";
46 option domain-name-servers ${NETDNS/ /, };
49 default-lease-time 600;
52 # ${NETADDRESS4F}/${NETADDRESS4#*/} subnet
53 subnet ${NETADDRESS4F} netmask ${NETADDRESS4M} {
55 option routers ${NETGATEWAY4};
59 hardware ethernet ${NETMAC};
60 fixed-address ${NETADDRESS4%/*};
65 cat << EOF > root/dhcpd6.conf
67 ddns-update-style none;
70 default-lease-time 600;
73 # Enable RFC 5007 support (same than for DHCPv4)
76 # vboxnet0 shared network
77 shared-network vboxnet0 {
79 option domain-name "${NETHOSTNAME#*.}";
82 # option dhcp6.name-servers ${NETGATEWAY6};
84 # private ${NETADDRESS6%::*}::/${NETADDRESS6#*/} subnet
85 subnet6 ${NETADDRESS6%::*}::/${NETADDRESS6#*/} {
87 range6 ${NETADDRESS6%::*}::2 ${NETADDRESS6%::*}::ffff:ffff;
90 # shared fe80::/64 subnet
97 #XXX: only work for ipv4 : hardware ethernet ${NETMAC};
98 #XXX: see journalctl -u dhcpd6.service to get virtualbox machine DUID
99 host-identifier option dhcp6.client-id 00:00:00:00:00:00:00:00:00:00:00:00:00:00;
101 fixed-address6 ${NETADDRESS6%/*};
106 cat << EOF > root/radvd.conf
107 # Radvd configuration
110 # Announce at regular interval
112 # Start service even if vboxnet0 is missing
114 # Force the configuration of client through dhcpv6
116 AdvOtherConfigFlag on;
118 prefix ${NETADDRESS6%::*}::/${NETADDRESS6#*/} {
119 # Announce that all address prefix are on-link
121 # Announce that the prefix can be used for autonomous address configuration
122 #XXX: off require a dhcpd6 configuration
124 # Announce that the interface address is sent instead of network prefix
128 prefix ${NETGATEWAY6}/128 {