generated from alice-meta-packages/alice-meta-template
			add ldap-hostname script and service
	
		
			
	
		
	
	
		
			
				
	
				Deploy Package / Explore-Gitea-Actions (push) Successful in 14s
				
					Details
				
			
		
	
				
					
				
			
				
	
				Deploy Package / Explore-Gitea-Actions (push) Successful in 14s
				
					Details
				
			
		
	This commit is contained in:
		
							parent
							
								
									60f506b2c7
								
							
						
					
					
						commit
						0a77bc0003
					
				| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
IP=$(hostname -I | awk '{print $1}')
 | 
			
		||||
HOSTNAME=$(getent hosts | grep $IP | awk '{print $2}')
 | 
			
		||||
 | 
			
		||||
if [ -n "$HOSTNAME" ]; then
 | 
			
		||||
    hostnamectl set-hostname "$HOSTNAME"
 | 
			
		||||
    echo "Hostname set to $HOSTNAME"
 | 
			
		||||
else
 | 
			
		||||
    echo "Hostname not found for IP $IP"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
[Unit]
 | 
			
		||||
Description=Set hostname based on IP from LDAP
 | 
			
		||||
After=network.target
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
Type=oneshot
 | 
			
		||||
ExecStart=/usr/bin/ldap-hostname
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=multi-user.target
 | 
			
		||||
		Loading…
	
		Reference in New Issue