]> gitweb.morketsmerke.org Git - immudex.git/commitdiff
Dostosowanie skryptów addonów do samodzielnej instalacji
authorxf0r3m <jakubstasinski@protonmail.com>
Wed, 20 Dec 2023 11:26:40 +0000 (12:26 +0100)
committerxf0r3m <jakubstasinski@protonmail.com>
Wed, 20 Dec 2023 11:26:40 +0000 (12:26 +0100)
addons/baytrail_sound
addons/iwlwifi
addons/lampstack
addons/nvidiaLatest

index 1805030107c004bb2deae7ad5af487db41c5606e..27a4cb3d0514443cf74f9d131ab6d13cb1d88b95 100644 (file)
@@ -3,47 +3,36 @@
 if [ "$1" ]; then
   case $1 in
     "install") echo "Installation $(basename $0) addon...";
-                if [ ! -d /usr/share/immudex-addons ]; then
-                  mkdir /usr/share/immudex-addons;
+                if [ ! -d /boot ]; then
+                  mkdir /boot;
+                       apt purge linux-image* --purge -y;
+                       apt install linux-image-amd64;
                 fi
-                cat >> $(basename $0)_installer << EOF
-if [ ! -d /boot ]; then
-  mkdir /boot;
-       apt purge linux-image* --purge -y;
-       apt install linux-image-amd64;
-fi
 
-cp -vv /etc/apt/sources.list /etc/apt/sources.list.d/baytrail-sound.list;
-sed -e 's/main/contrib non-free non-free-firmware/g' -i /etc/apt/sources.list.d/baytrail-sound.list;
+                cp -vv /etc/apt/sources.list /etc/apt/sources.list.d/baytrail-sound.list;
+                sed -e 's/main/contrib non-free non-free-firmware/g' -i /etc/apt/sources.list.d/baytrail-sound.list;
 
-apt update;
-apt install firmware-sof-signed firmware-intel-sound;
+                apt update;
+                apt install firmware-sof-signed firmware-intel-sound;
+                if [ $? -eq 0 ]; then success=0; else success=1; fi
+                rm /etc/apt/sources.list.d/baytrail-sound.list;
+                apt update;
 
-rm /etc/apt/sources.list.d/baytrail-sound.list;
-apt update;
+                apt-get autoclean;
+                apt-get autoremove;
+                apt-get clean;
+                apt-get clean;
 
-apt-get autoclean;
-apt-get autoremove;
-apt-get clean;
-apt-get clean;
-EOF
-                bash $(basename $0)_installer;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_installer;
-                  echo $(basename $0) | tee -a /usr/share/immudex-addons/installed-addons;
+                if [ $success -eq 0 ]; then
                   echo "Installation $(basename $0) addon...[ OK ]";
                 fi;;
     "remove") echo "Removing $(basename $0) addon...";
-                cat >> $(basename $0)_uninstaller << EOF
-apt remove -y firmware-sof-signed firmware-intel-sound;
-apt-get autoclean;
-apt-get autoremove -y;
-apt-get clean;
-EOF
-                bash $(basename $0)_uninstaller;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_uninstaller;
-                  sed -i "s/$(basename $0)//g" /usr/share/immudex-addons/installed-addons;
+                apt remove -y firmware-sof-signed firmware-intel-sound;
+                if [ $? -eq 0 ]; then success=0; else success=1; fi
+                apt-get autoclean;
+                apt-get autoremove -y;
+                apt-get clean;
+                if [ $success -eq 0 ]; then
                   echo "Removing $(basename $0) addon...[ OK ]";
                 fi;;
   esac
index dce35bf7907fb79655b3c0bb7999e2f05d7b7d8a..97338c70f2aa504214d0ecee644b879ad2133afc 100644 (file)
@@ -3,47 +3,36 @@
 if [ "$1" ]; then
   case $1 in
     "install") echo "Installation $(basename $0) addon...";
-                if [ ! -d /usr/share/immudex-addons ]; then
-                  mkdir /usr/share/immudex-addons;
+                if [ ! -d /boot ]; then
+                  mkdir /boot;
+                       apt purge linux-image* --purge -y;
+                       apt install linux-image-amd64;
                 fi
-                cat >> $(basename $0)_installer << EOF
-if [ ! -d /boot ]; then
-  mkdir /boot;
-       apt purge linux-image* --purge -y;
-       apt install linux-image-amd64;
-fi
-
-cp -vv /etc/apt/sources.list /etc/apt/sources.list.d/iwlwifi.list;
-sed -e 's/main/contrib non-free non-free-firmware/g' -i /etc/apt/sources.list.d/iwlwifi.list;
 
-apt update;
-apt install firmware-iwlwifi;
+                cp -vv /etc/apt/sources.list /etc/apt/sources.list.d/iwlwifi.list;
+                sed -e 's/main/contrib non-free non-free-firmware/g' -i /etc/apt/sources.list.d/iwlwifi.list;
 
-rm /etc/apt/sources.list.d/iwlwifi.list;
-apt update;
+                apt update;
+                apt install firmware-iwlwifi;
+                if [ $? -eq 0 ]; then success=0; else succes=1; fi
+                rm /etc/apt/sources.list.d/iwlwifi.list;
+                apt update;
 
-apt-get autoclean;
-apt-get autoremove;
-apt-get clean;
-apt-get clean;
-EOF
-                bash $(basename $0)_installer;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_installer;
-                  echo $(basename $0) | tee -a /usr/share/immudex-addons/installed-addons;
+                apt-get autoclean;
+                apt-get autoremove;
+                apt-get clean;
+                apt-get clean;
+                if [ $success -eq 0 ]; then
                   echo "Installation $(basename $0) addon...[ OK ]";
                 fi;;
     "remove") echo "Removing $(basename $0) addon...";
-                cat >> $(basename $0)_uninstaller << EOF
-apt remove -y firmware-iwlwifi;
-apt-get autoclean;
-apt-get autoremove -y;
-apt-get clean;
-EOF
-                bash $(basename $0)_uninstaller;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_uninstaller;
-                  sed -i "s/$(basename $0)//g" /usr/share/immudex-addons/installed-addons;
+                apt remove -y firmware-iwlwifi;
+                if [ $? -eq 0 ]; then success=0; else success=1; fi
+                apt-get autoclean;
+                apt-get autoremove -y;
+                apt-get clean;
+
+                if [ $success -eq 0 ]; then
                   echo "Removing $(basename $0) addon...[ OK ]";
                 fi;;
   esac
index ba05a553e7c33a031f4f44db5f67fc6d17ccfeba..4ba3d85d7373ccc606b31bd787f3fd2f1e2ff121 100644 (file)
@@ -3,57 +3,45 @@
 if [ "$1" ]; then
   case $1 in
     "install") echo "Installation $(basename $0) addon...";
-                if [ ! -d /usr/share/immudex-addons ]; then
-                  mkdir /usr/share/immudex-addons;
-                fi
-                cat >> $(basename $0)_installer << EOF
-baseVersion=\$(head -1 /etc/apt/sources.list | awk '{print \$3}')
-
-apt install lsb-release;
-wget https://dev.mysql.com/get/mysql-apt-config_0.8.25-1_all.deb;
-dpkg -i mysql-apt-config_0.8.25-1_all.deb;
-
-sed -i "s/\$baseVersion/bullseye/g" /etc/apt/sources.list;
-
-apt update;
-apt install mysql-server -y
-apt-get install --fix-missing
-
-apt-mark hold libmecab2 libssl1.1 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core
-
-sed -i "s/bullseye/\$baseVersion/g" /etc/apt/sources.list; 
-apt update
-apt install apache2 libapache2-mod-php php php-mysql -y;
-
-apt autoremove;
-apt autoclean;
-apt clean;
-apt clean;
-
-rm mysql-apt-config_0.8.25-1_all.deb;
-EOF
-                bash $(basename $0)_installer;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_installer;
-                  echo $(basename $0) | tee -a /usr/share/immudex-addons/installed-addons;
+                baseVersion=$(head -1 /etc/apt/sources.list | awk '{print $3}')
+
+                apt install lsb-release -y;
+                wget https://dev.mysql.com/get/mysql-apt-config_0.8.25-1_all.deb;
+                dpkg -i mysql-apt-config_0.8.25-1_all.deb;
+
+                sed -i "s/$baseVersion/bullseye/g" /etc/apt/sources.list;
+
+                apt update;
+                apt install mysql-server -y
+                apt-get install --fix-missing
+                if [ $? -eq 0 ]; then mysqlSuccess=0; else mysqlSuccess=1; fi
+
+                apt-mark hold libmecab2 libssl1.1 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core
+
+                sed -i "s/bullseye/$baseVersion/g" /etc/apt/sources.list; 
+                apt update
+                apt install apache2 libapache2-mod-php php php-mysql -y;
+                if [ $? -eq 0 ]; then phpApacheSucces=0; else phpApacheSuccess=1; fi
+                apt autoremove;
+                apt autoclean;
+                apt clean;
+                apt clean;
+
+                rm mysql-apt-config_0.8.25-1_all.deb;
+                if [ $((mysqlSuccess * phpApacheSuccess)) -eq 0 ]; then
                   echo "Installation $(basename $0) addon...[ OK ]";
                 fi;;
     "remove") echo "Removing $(basename $0) addon...";
-                cat >> $(basename $0)_uninstaller << EOF
-apt-mark unhold libmecab2 libssl1.1 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core
-
-apt-get remove -y libssl1.1  mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core apache2 libapache2-mod-php php php-mysql mysql-apt-config
+                apt-mark unhold libmecab2 libssl1.1 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core
 
-apt-get upgrade -y libmecab2 mecab-utils mecab-ipadic mecab-ipadic-utf8;
+                apt-get remove -y libssl1.1  mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins mysql-community-server mysql-community-server-core apache2 libapache2-mod-php php php-mysql mysql-apt-config
+                if [ $? -eq 0 ]; then success=0; else success=1; fi
+                apt-get upgrade -y libmecab2 mecab-utils mecab-ipadic mecab-ipadic-utf8;
 
-apt-get autoclean
-apt-get autoremove -y
-apt-get clean
-EOF
-                bash $(basename $0)_uninstaller;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_uninstaller;
-                  sed -i "s/$(basename $0)//g" /usr/share/immudex-addons/installed-addons;
+                apt-get autoclean
+                apt-get autoremove -y
+                apt-get clean
+                if [ $success -eq 0 ]; then
                   echo "Removing $(basename $0) addon...[ OK ]";
                 fi;;
   esac
index 4e91a44a755ebc2e87701e2806da20612a1d4481..a592127cf462948fe065107fba898e18de52370e 100644 (file)
@@ -3,49 +3,37 @@
 if [ "$1" ]; then
   case $1 in
     "install") echo "Installation $(basename $0) addon...";
-                if [ ! -d /usr/share/immudex-addons ]; then
-                  mkdir /usr/share/immudex-addons;
+                if [ ! -f /proc/cpuinfo ]; then
+                  echo "There is no system interfaces! Nothing to do. Exiting...";
+                  exit 1;
+                else
+                if [ ! -d /boot ]; then
+                       mkdir /boot;
+                       apt purge linux-image* --purge -y;
+                       apt install linux-image-amd64 -y;
                 fi
-                cat >> $(basename $0)_installer << EOF
-if [ ! -f /proc/cpuinfo ]; then
-echo "There is no system interfaces! Nothing to do. Exiting...";
-rm \$0;
-exit 1;
-else
-if [ ! -d /boot ]; then
-       mkdir /boot;
-       apt purge linux-image* --purge -y;
-       apt install linux-image-amd64 -y;
-fi
 
-cp -vv /etc/apt/sources.list /etc/apt/sources.list.d/nvidia.list;
-sed -e 's/main/contrib non-free non-free-firmware/g' -i /etc/apt/sources.list.d/nvidia.list;
-apt update;
-apt install -y build-essential dkms linux-headers-\$(uname -r);
-apt install -y nvidia-detect;
-apt install -y nvidia-driver;
-fi
-EOF
-                bash $(basename $0)_installer;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_installer;
-                  echo $(basename $0) | sudo tee -a /usr/share/immudex-addons/installed-addons;
+                  cp -vv /etc/apt/sources.list /etc/apt/sources.list.d/nvidia.list;
+                  sed -e 's/main/contrib non-free non-free-firmware/g' -i /etc/apt/sources.list.d/nvidia.list;
+                  apt update;
+                  apt install -y build-essential dkms linux-headers-\$(uname -r);
+                  apt install -y nvidia-detect;
+                  apt install -y nvidia-driver;
+                  if [ $? -eq 0 ]; then success=0; else; success=1; fi
+                fi
+                if [ $success -eq 0 ]; then
                   echo "Installation $(basename $0) addon...[ OK ]";
                 fi;;
     "remove") echo "Removing $(basename $0) addon...";
-                cat >> $(basename $0)_uninstaller << EOF
-apt remove -y nvidia-driver nvidia-detect dkms linux-headers-\$(uname -r);
-apt purge -y nvidia-*;
-rm /etc/apt/sources.list.d/nvidia.list;
-apt update;
-apt-get autoremove -y;
-apt-get autoclean;
-apt-get clean;
-EOF
-                bash $(basename $0)_uninstaller;
-                if [ $? -eq 0 ]; then
-                  rm $(basename $0)_uninstaller;
-                  sed -i "s/$(basename $0)//g" /usr/share/immudexi-addons/installed-addons;
+                apt remove -y nvidia-driver nvidia-detect dkms linux-headers-\$(uname -r);
+                apt purge -y nvidia-*;
+                if [ $? -eq 0 ]; then success=0; else success=1; fi
+                rm /etc/apt/sources.list.d/nvidia.list;
+                apt update;
+                apt-get autoremove -y;
+                apt-get autoclean;
+                apt-get clean;
+                if [ $success -eq 0 ]; then
                   echo "Removing $(basename $0) addon...[ OK ]";
                 fi;;
   esac