20 lines
		
	
	
		
			738 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			20 lines
		
	
	
		
			738 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								#!/bin/sh
							 | 
						||
| 
								 | 
							
								set -e
							 | 
						||
| 
								 | 
							
								# The hostname and hostid of the last system to access a ZFS pool are stored in
							 | 
						||
| 
								 | 
							
								# the ZFS pool itself. A pool is foreign if, during `zpool import`, the
							 | 
						||
| 
								 | 
							
								# current hostname and hostid are different than the stored values thereof.
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# The only way of having a stable hostid is to define it in /etc/hostid.
							 | 
						||
| 
								 | 
							
								# This postinst helper will check if we already have the hostid stabilized by
							 | 
						||
| 
								 | 
							
								# checking the existence of the file /etc/hostid to be 4 bytes at least.
							 | 
						||
| 
								 | 
							
								# If this file don't already exists on our system or has less than 4 bytes, then
							 | 
						||
| 
								 | 
							
								# a new (random) value is generated with zgenhostid (8) and stored in
							 | 
						||
| 
								 | 
							
								# /etc/hostid
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if [ ! -f /etc/hostid ] || [ "$(stat -c %s /etc/hostid)" -lt 4 ] ; then
							 | 
						||
| 
								 | 
							
									zgenhostid
							 | 
						||
| 
								 | 
							
								fi
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#DEBHELPER#
							 | 
						||
| 
								 | 
							
								
							 |