github.com/crowdsecurity/crowdsec@v1.6.1/test/bats-detect/testdata/enable_lst_debian_repo.sh (about)

     1  #!/bin/bash
     2  
     3  
     4  if [ -r /etc/os-release ]; then
     5  
     6  	echo " detecting OS type : "
     7  
     8  	. /etc/os-release
     9  
    10  	if [ $ID == "debian" ]; then
    11  		echo "detected OS: $ID - $VERSION_ID"
    12  		echo " now enable the LiteSpeed Debian Repo "
    13  		if [ $VERSION_ID == "11" ]; then	
    14                          echo "deb http://rpms.litespeedtech.com/debian/ bullseye main" > /etc/apt/sources.list.d/lst_debian_repo.list
    15                          echo "#deb http://rpms.litespeedtech.com/edge/debian/ bullseye main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    16  		elif [ $VERSION_ID == "10" ]; then	
    17                          echo "deb http://rpms.litespeedtech.com/debian/ buster main" > /etc/apt/sources.list.d/lst_debian_repo.list
    18                          echo "#deb http://rpms.litespeedtech.com/edge/debian/ buster main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    19  		elif [ $VERSION_ID == "9" ]; then
    20                          echo "deb http://rpms.litespeedtech.com/debian/ stretch main" > /etc/apt/sources.list.d/lst_debian_repo.list
    21                          echo "#deb http://rpms.litespeedtech.com/edge/debian/ stretch main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    22                  elif [ $VERSION_ID == "8" ]; then
    23  			echo "deb http://rpms.litespeedtech.com/debian/ jessie main" > /etc/apt/sources.list.d/lst_debian_repo.list
    24  			echo "#deb http://rpms.litespeedtech.com/edge/debian/ jessie main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    25  		fi
    26  	elif [ $ID == "ubuntu" ]; then
    27  		echo "detected OS: $ID - $VERSION_ID"
    28  		echo " now enable the LiteSpeed Debian Repo "
    29  		if [ `echo "$VERSION_ID" | cut -b-2 ` == "14" ]; then
    30  			echo "deb http://rpms.litespeedtech.com/debian/ trusty main" > /etc/apt/sources.list.d/lst_debian_repo.list
    31  			echo "#deb http://rpms.litespeedtech.com/edge/debian/ trusty main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    32  		elif [ `echo "$VERSION_ID" | cut -b-2 ` == "12" ]; then
    33  			echo "deb http://rpms.litespeedtech.com/debian/ precise main" > /etc/apt/sources.list.d/lst_debian_repo.list
    34  			echo "#deb http://rpms.litespeedtech.com/edge/debian/ precise main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    35  		elif [ `echo "$VERSION_ID" | cut -b-2 ` == "16" ]; then
    36  			echo "deb http://rpms.litespeedtech.com/debian/ xenial main" > /etc/apt/sources.list.d/lst_debian_repo.list
    37  			echo "#deb http://rpms.litespeedtech.com/edge/debian/ xenial main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    38  		elif [ `echo "$VERSION_ID" | cut -b-2 ` == "18" ]; then
    39  			echo "deb http://rpms.litespeedtech.com/debian/ bionic main" > /etc/apt/sources.list.d/lst_debian_repo.list
    40  			echo "#deb http://rpms.litespeedtech.com/edge/debian/ bionic main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    41  		elif [ `echo "$VERSION_ID" | cut -b-2 ` == "20" ]; then
    42  			echo "deb http://rpms.litespeedtech.com/debian/ focal main" > /etc/apt/sources.list.d/lst_debian_repo.list
    43  			echo "#deb http://rpms.litespeedtech.com/edge/debian/ focal main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    44  		elif [ `echo "$VERSION_ID" | cut -b-2 ` == "22" ]; then
    45  			echo "deb http://rpms.litespeedtech.com/debian/ focal main" > /etc/apt/sources.list.d/lst_debian_repo.list
    46  			echo "#deb http://rpms.litespeedtech.com/edge/debian/ focal main" >> /etc/apt/sources.list.d/lst_debian_repo.list
    47  		fi
    48  	else
    49  		echo " This distribution is not currently supported by LST repo "
    50  		echo " If you really have the needs please contact LiteSpeed for support "
    51  	fi
    52  else
    53  	echo " The /etc/os-release file doesn't exist "
    54  	echo " This script couldn't determine which distribution of the repo should be enabled "
    55  	echo " Please consult LiteSpeed Customer Support for further assistance "
    56  fi
    57  
    58  echo " register LiteSpeed GPG key "
    59  wget -O /etc/apt/trusted.gpg.d/lst_debian_repo.gpg http://rpms.litespeedtech.com/debian/lst_debian_repo.gpg
    60  wget -O /etc/apt/trusted.gpg.d/lst_repo.gpg http://rpms.litespeedtech.com/debian/lst_repo.gpg
    61  
    62  echo " update the repo "
    63  apt-get update
    64  
    65  echo " All done, congratulations and enjoy ! "