From: xf0r3m Date: Sat, 22 Jul 2023 09:47:21 +0000 (+0200) Subject: Próba dostosowania 'immudex_hostname' do informacji zwracanych przez polecenie 'hostn... X-Git-Url: https://gitweb.morketsmerke.org/?a=commitdiff_plain;h=27af4b9bbbd295b0a8a3c5e7744bbd741ceb4159;p=immudex-lhe.git Próba dostosowania 'immudex_hostname' do informacji zwracanych przez polecenie 'hostnamectl' w Debian 10 Buster - narzędzie tools/000/immudex_hostanem --- diff --git a/tools/000/immudex_hostname b/tools/000/immudex_hostname index d147a2a..a1ff456 100755 --- a/tools/000/immudex_hostname +++ b/tools/000/immudex_hostname @@ -4,18 +4,42 @@ vendor=$(hostnamectl | grep 'Vendor' | awk '{printf $3}') modelLine=$(hostnamectl | grep 'Model' | awk '{printf $3}') model=$(hostnamectl | grep 'Model' | awk '{printf $4}') -case $vendor in - "Lenovo") vendorShort="l";; - "Dell") vendorShort="d";; - *) hName="immudex";; -esac +if [ "$vendor" ] && [ "$modelLine" ] && [ "$model" ]; then -case $modelLine in - "ThinkPad") mLShort="TP";; - "Latitude") mLShort="Lat";; - *) hName="immudex";; -esac + case $vendor in + "Lenovo") vendorShort="l";; + "Dell") vendorShort="d";; + "Acer") vendorShort="a";; + "ASUSTeK") vendorShort="as";; + "GOOGLE") vendorShort="go";; + "QEMU") vendorShort="kvm";; + *) hName="immudex";; + esac + case $modelLine in + "ThinkPad") mLShort="TP";; + "Latitude") mLShort="Lat";; + "AOD260") mLShort="ao"; + model="D260";; + "Candy") vendorShort="d"; + mLShort="chrbook"; + model="3120";; + "Inspiron") mLShort="Ins";; + "Standard") if [ $vendorShort = "kvm" ]; then + mLShort=$(hostnamectl | grep 'Machine ID' | awk '{print $3}' | cut -c 26-33); + model=""; + else + mlShort="Std"; + fi;; + *) hName="immudex";; + esac +else + if hostnamectl | grep -q 'kvm'; then + vendorShort="kvm"; + mLShort=$(hostnamectl | grep 'Machine ID' | awk '{print $3}' | cut -c 26-33); + model=""; + fi +fi if [ ! "$hName" ]; then hName="${vendorShort}-${mLShort}-$model" sudo hostnamectl set-hostname $hName;