#!/bin/sh mountdef="$(grep -Eo 'home=[^ ]+' /proc/cmdline)" mountdef="${mountdef#home=}" mountpath="${mountdef%%;*}" mountpath="${mountpath#*://}" mounttype="${mountdef%%://*}" mountopts="${mountdef#*;}" macaddr="$(ip address show |grep -Eom1 'link/ether [0-9a-fA-F:]+' |tr : _)" macaddr="${macaddr#link/ether }" [ "$mounttype" = "$mountdef" ] && mounttype=auto [ ! "$macaddr" ] && macaddr=noname if [ "$mountpath" -a "$mountopts" ]; then mount -t "$mounttype" "$mountpath" /home -o "$mountopts" elif [ "$mountpath" ]; then mount -t "$mounttype" "$mountpath" /home fi usermod -d "/home/${macaddr}/" guest