forked from Sysdeploy/ipxe_scripts
Compare commits
13 Commits
master
...
c5e2c6a4a3
Author | SHA1 | Date |
---|---|---|
Peter Šurda | c5e2c6a4a3 | |
Max Weiss | bffbacba14 | |
Peter Šurda | 040fa526b4 | |
Peter Šurda | d37f24e379 | |
Peter Šurda | 892e6f060d | |
Peter Šurda | e79ea2eaa2 | |
Max Weiss | fdc4e5333a | |
Max Weiss | 9e48a70ce9 | |
Max Weiss | fed7a5ed1d | |
Max Weiss | f5407e66d5 | |
Max Weiss | 108764fc51 | |
Max Weiss | d0c5287736 | |
Peter Šurda | 4f98a35a4e |
|
@ -11,11 +11,12 @@ function clone_ipxe_upstream() {
|
|||
|
||||
#git clone git://git.ipxe.org/ipxe.git "$ipxe_src_dir" || return 1
|
||||
git submodule update --init --recursive
|
||||
curr="$(pwd)"
|
||||
cd "$ipxe_src_dir"
|
||||
|
||||
# Known good commit
|
||||
git checkout 56f7d44fde1d6ac196d115cc7dddd58e7ec098fa || return 1
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -77,11 +78,12 @@ function make_ipxe_lkrn() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "${ipxe_src_dir}/src/" || return 1
|
||||
|
||||
make bin/ipxe.lkrn EMBED="${embed_file}" CERT="${signing_cert},${ca_cert}" TRUST="${ca_cert}" || return 2
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -112,10 +114,12 @@ function make_ipxe_iso() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "${ipxe_src_dir}/src/" || return 1
|
||||
|
||||
make bin/ipxe.iso EMBED="${embed_file}" CERT="${signing_cert},${ca_cert}" TRUST="${ca_cert}" || return 2
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -135,10 +139,11 @@ function make_ipxe_bin_shasums() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "${ipxe_src_dir}/src/bin/" || return 1
|
||||
|
||||
sha256sum ipxe.lkrn ipxe.iso > SHA256SUMS || return 2
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -163,8 +168,12 @@ function tag_head_and_push() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "$git_repo_dir"
|
||||
|
||||
git config user.name "BuildBot"
|
||||
git config user.email "buildbot@bitmessage.io"
|
||||
|
||||
git tag -n | grep $(git rev-parse HEAD)
|
||||
if [ $? -eq 0 ]; then
|
||||
>&2 echo 'HEAD tag already exists, bailing out...'
|
||||
|
@ -172,12 +181,13 @@ function tag_head_and_push() {
|
|||
fi
|
||||
|
||||
git tag -a "g_$(git rev-parse HEAD)" HEAD -m "BuildBot: tag commit for release $(git rev-parse HEAD)" || return 2
|
||||
git push --tags "$remote" "$branch"
|
||||
#git push --tags origin master
|
||||
if [ $? -ne 0 ]; then
|
||||
>&2 echo 'Error during attempted git push of new tag'
|
||||
return 3
|
||||
fi
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -209,6 +219,7 @@ function create_release() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "$git_repo_dir"
|
||||
head="$(git rev-parse HEAD)"
|
||||
|
||||
|
@ -242,6 +253,7 @@ EOF
|
|||
return 2
|
||||
fi
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -290,6 +302,7 @@ function upload_release_ipxe_lkrn() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "$git_repo_dir"
|
||||
|
||||
cat release_results.txt | grep ^HTTP/ | grep 201 >/dev/null
|
||||
|
@ -321,6 +334,7 @@ function upload_release_ipxe_lkrn() {
|
|||
return 2
|
||||
fi
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -369,6 +383,7 @@ function upload_release_ipxe_iso() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "$git_repo_dir"
|
||||
|
||||
cat release_results.txt | grep ^HTTP/ | grep 201 >/dev/null
|
||||
|
@ -400,6 +415,7 @@ function upload_release_ipxe_iso() {
|
|||
return 2
|
||||
fi
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -448,6 +464,7 @@ function upload_release_ipxe_shasums() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
curr="$(pwd)"
|
||||
cd "$git_repo_dir"
|
||||
|
||||
cat release_results.txt | grep ^HTTP/ | grep 201 >/dev/null
|
||||
|
@ -479,6 +496,7 @@ function upload_release_ipxe_shasums() {
|
|||
return 2
|
||||
fi
|
||||
|
||||
cd "$curr"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
54
embed.ipxe
54
embed.ipxe
|
@ -34,16 +34,29 @@ isset ${net${idx}/mac} || goto loop_done
|
|||
|
||||
######################## SET STATIC IP INFO HERE #############################
|
||||
# Just copy/paste an entire line to add more
|
||||
#
|
||||
echo Checking net${idx}
|
||||
|
||||
# node1.bitmessage.at
|
||||
iseq ${net${idx}/mac} 40:a8:f0:31:cc:58 && set ip-dev-name eno1 && set ip-addr 93.189.28.82 && set ip-gateway 93.189.28.81 && set ip-netmask 255.255.255.240 && set ip-dns 1.1.1.1 && set successful t && goto loop_done ||
|
||||
iseq ${net${idx}/mac} 40:a8:f0:31:cc:59 && set ip-dev-name eno2 && set ip-addr 93.189.28.82 && set ip-gateway 93.189.28.81 && set ip-netmask 255.255.255.240 && set ip-dns 1.1.1.1 && set successful t && goto loop_done ||
|
||||
# node2.bitmessage.at
|
||||
iseq ${net${idx}/mac} 28:80:23:a7:52:d0 && set ip-dev-name eno1 && set ip-addr 10.11.12.13 && set ip-gateway 10.11.12.1 && set ip-netmask 255.255.255.0 && set ip-dns 1.1.1.1 && set successful t && goto loop_done ||
|
||||
iseq ${net${idx}/mac} 28:80:23:a7:52:d1 && set ip-dev-name eno2 && set ip-addr 10.11.12.13 && set ip-gateway 10.11.12.1 && set ip-netmask 255.255.255.0 && set ip-dns 1.1.1.1 && set successful t && goto loop_done ||
|
||||
# node1.surda.cloud
|
||||
iseq ${net${idx}/mac} d0:50:99:df:1d:49 && set ip-dev-name enp39s0 && set ip-addr 93.189.28.83 && set ip-gateway 93.189.28.81 && set ip-netmask 255.255.255.240 && set ip-dns 1.1.1.1 && set successful t && goto loop_done ||
|
||||
iseq ${net${idx}/mac} d0:50:99:df:1d:4a && set ip-dev-name enp38s0 && set ip-addr 93.189.28.83 && set ip-gateway 93.189.28.81 && set ip-netmask 255.255.255.240 && set ip-dns 1.1.1.1 && set successful t && goto loop_done ||
|
||||
|
||||
# if you don't know the linux interface name, use "clear ip-dev-name", then
|
||||
# it will use ALL interfaces
|
||||
|
||||
iseq ${net${idx}/mac:string} "00:01:02:A0:B1:C1" && set ip-dev-name eth0 && set ip-addr "192.168.1.5" && set ip-gateway "192.168.1.1" && set ip-netmask "255.255.255.0" && set ip-dns "1.1.1.1" && set successful t && goto loop_done ||
|
||||
iseq ${net${idx}/mac:string} "03:04:05:D4:E5:F6" && set ip-dev-name eth0 && set ip-addr "192.168.99.2" && set ip-gateway "192.168.99.1" && set ip-netmask "255.255.255.0" && set ip-dns "1.1.1.1" && set successful t && goto loop_done ||
|
||||
##############################################################################
|
||||
inc idx && goto loop
|
||||
|
||||
:loop_done
|
||||
# If we have not successfully found a MAC match, then we error, because we
|
||||
# also failed DHCP. So there's nothing we can do but fail.
|
||||
iseq successful f && goto error_handler
|
||||
iseq ${successful} f && goto error_handler ||
|
||||
|
||||
# If on the other hand we're successful, then we construct the kernel ip= line
|
||||
set ip-info ${ip-addr}::${ip-gateway}:${ip-netmask}::${ip-dev-name}:off:${ip-dns}
|
||||
|
@ -79,6 +92,32 @@ goto boot_all
|
|||
#################
|
||||
|
||||
|
||||
:try_next_card
|
||||
imgfree
|
||||
ifclose
|
||||
sleep 1
|
||||
# If dhcp, it will go to the static boot, which already has ifopen
|
||||
iseq ip-info dhcp || ifopen
|
||||
iseq ip-info dhcp || sleep 1
|
||||
iseq ip-info dhcp && clear ip-info && goto try_static_from_dhcp_fail || goto try_next_static_card
|
||||
|
||||
:try_static_from_dhcp_fail
|
||||
iseq arch-info arm64 && goto static_ip_boot_arm64 ||
|
||||
iseq arch-info amd64 && goto static_ip_boot_amd64 ||
|
||||
goto error_handler
|
||||
|
||||
:try_next_static_card
|
||||
isset ip-dev-name && clear ip-dev-name
|
||||
isset ip-addr && clear ip-addr
|
||||
isset ip-gateway && clear ip-gateway
|
||||
isset ip-netmask && clear ip-netmask
|
||||
isset ip-dns && clear ip-dns
|
||||
isset successful && clear successful
|
||||
set successful f
|
||||
isset idx && inc idx || goto error_handler
|
||||
goto loop
|
||||
|
||||
|
||||
# In case we want to... log?? Or do something else.
|
||||
:error_handler
|
||||
echo "###########################################################"
|
||||
|
@ -150,7 +189,7 @@ goto static_ip_boot_setup
|
|||
# However, note that imgverify will fail if you refer to it as "/squashfs"
|
||||
# instead of "squashfs".
|
||||
|
||||
imgfetch http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/squashfs /squashfs || goto error_handler
|
||||
imgfetch http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/squashfs /squashfs || goto try_next_card
|
||||
imgverify --signer images.sysdeploy.org squashfs http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/squashfs.sig || goto error_handler
|
||||
|
||||
# "--signer" validates against the subject common name field of the signing
|
||||
|
@ -162,16 +201,19 @@ imgverify --signer images.sysdeploy.org squashfs http://images.sysdeploy.org/${u
|
|||
# using a custom CA that you import during build.
|
||||
|
||||
|
||||
initrd http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-initrd || goto error_handler
|
||||
initrd http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-initrd || goto try_next_card
|
||||
imgverify --signer images.sysdeploy.org boot-initrd http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-initrd.sig || goto error_handler
|
||||
|
||||
kernel http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-kernel || goto error_handler
|
||||
kernel http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-kernel || goto try_next_card
|
||||
imgverify --signer images.sysdeploy.org boot-kernel http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-kernel.sig || goto error_handler
|
||||
|
||||
|
||||
# Get accurate time so we can set the clock in kernel boot cmdline
|
||||
ntp pool.ntp.org || goto error_handler
|
||||
|
||||
echo ip-info ${ip-info}
|
||||
|
||||
sleep 1
|
||||
|
||||
boot boot-kernel initrd=boot-initrd rootfstype=squashfs root=/squashfs ip=${ip-info} overlayroot=tmpfs:recurse=0 systemd.clock-usec=${unixtime:int32}000000 ds=nocloud-net;s=https://cloud-init.sysdeploy.org/ || goto error_handler
|
||||
|
||||
|
|
Loading…
Reference in New Issue