Initial commit
This commit is contained in:
commit
968d09e362
88 changed files with 2323 additions and 0 deletions
5
os/installer-udeb/inventory-hostname/debian/changelog
Normal file
5
os/installer-udeb/inventory-hostname/debian/changelog
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
inventory-hostname (0) UNRELEASED; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Jan Schär <jan@soi.ch> Fri, 02 Feb 2024 21:37:43 +0000
|
||||
12
os/installer-udeb/inventory-hostname/debian/control
Normal file
12
os/installer-udeb/inventory-hostname/debian/control
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Source: inventory-hostname
|
||||
Section: debian-installer
|
||||
Priority: optional
|
||||
Maintainer: Jan Schär <jan@soi.ch>
|
||||
Build-Depends: debhelper-compat (= 13)
|
||||
|
||||
Package: inventory-hostname
|
||||
Package-Type: udeb
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}
|
||||
XB-Installer-Menu-Item: 1650
|
||||
Description: Configure hostname using inventory list.
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh -e
|
||||
. /usr/share/debconf/confmodule
|
||||
db_capb backup
|
||||
|
||||
log() {
|
||||
logger -t inventory-hostname "$@"
|
||||
}
|
||||
|
||||
INVENTORY_FILE=/cdrom/install/inventory.txt
|
||||
|
||||
SERIAL=$(cat /sys/class/dmi/id/product_serial)
|
||||
|
||||
if [ -z "$SERIAL" ]; then
|
||||
log "Warning: No serial number found, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f "$INVENTORY_FILE" ]; then
|
||||
log "Warning: No inventory file found at $INVENTORY_FILE, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SET_HOSTNAME=$(sed -n -e "s/^${SERIAL}\s\+\([0-9A-Za-z.-]\+\)\$/\1/p" "$INVENTORY_FILE")
|
||||
|
||||
if [ -z "$SET_HOSTNAME" ]; then
|
||||
db_subst inventory-hostname/get_hostname SERIAL "$SERIAL"
|
||||
if ! db_input high inventory-hostname/get_hostname; then
|
||||
# question not asked
|
||||
exit 0
|
||||
fi
|
||||
if ! db_go; then
|
||||
exit 10 # back up
|
||||
fi
|
||||
|
||||
db_get inventory-hostname/get_hostname
|
||||
SET_HOSTNAME="$RET"
|
||||
elif [ "$(echo "$SET_HOSTNAME" | wc -l)" != "1" ]; then
|
||||
log "Warning: Multiple inventory entries found for serial number $SERIAL, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
db_set netcfg/get_hostname "$SET_HOSTNAME"
|
||||
db_fset netcfg/get_hostname seen true
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
Template: debian-installer/inventory-hostname/title
|
||||
Type: text
|
||||
Description: Set hostname from inventory list
|
||||
|
||||
Template: inventory-hostname/get_hostname
|
||||
Type: string
|
||||
Default: debian
|
||||
Description: Hostname:
|
||||
WARNING: The serial number of this machine was not found in the inventory list.
|
||||
Are you sure you want to install on this machine?
|
||||
If yes, you may want to add this machine to the inventory.
|
||||
.
|
||||
Serial number: ${SERIAL}
|
||||
.
|
||||
You can manually enter a hostname.
|
||||
3
os/installer-udeb/inventory-hostname/debian/rules
Executable file
3
os/installer-udeb/inventory-hostname/debian/rules
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#! /usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
Loading…
Add table
Add a link
Reference in a new issue