]> gitweb.morketsmerke.org Git - immudex-lhe.git/commitdiff
PrĂ³ba dostosowania 'immudex_hostname' do informacji zwracanych przez polecenie 'hostn...
authorxf0r3m <jakubstasinski@protonmail.com>
Sat, 22 Jul 2023 09:47:21 +0000 (11:47 +0200)
committerxf0r3m <jakubstasinski@protonmail.com>
Sat, 22 Jul 2023 09:47:21 +0000 (11:47 +0200)
tools/000/immudex_hostname

index d147a2a0da602ef2b025379711ae6432b43fbf4c..a1ff456912627fbc66ad57dbafa16a4de081b852 100755 (executable)
@@ -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;