Deprectated GetExternalResources script

Functionality is now added to init sh off CT that need external resources
This commit is contained in:
2022-07-02 21:28:29 +02:00
parent 1aadb13bde
commit d47e3d8ebe
17 changed files with 54 additions and 75 deletions

2
.vscode/tasks.json vendored
View File

@@ -16,7 +16,7 @@
{ {
"label": "SetupImgBuilder", "label": "SetupImgBuilder",
"type": "shell", "type": "shell",
"command": "git clone https://github.com/lxc/distrobuilder distrobuilderSRC; cd distrobuilderSRC; gofmt -s -w .; go build -o ../ -v ./...; cd ../; rm -rf distrobuilderSRC ; bash Scripts/GetExternalResources.sh", "command": "git clone https://github.com/lxc/distrobuilder distrobuilderSRC; cd distrobuilderSRC; gofmt -s -w .; go build -o ../ -v ./...; cd ../; rm -rf distrobuilderSRC",
"problemMatcher": [], "problemMatcher": [],
"group": { "group": {
"kind": "build", "kind": "build",

View File

@@ -26,7 +26,6 @@ pipeline {
// Setup Env // Setup Env
sh '''mkdir $WORKSPACE/REL sh '''mkdir $WORKSPACE/REL
mv distrobuilder-* distrobuilder mv distrobuilder-* distrobuilder
bash Scripts/GetExternalResources.sh
''' '''
//Check if Proxy is disabled //Check if Proxy is disabled
script{ script{

View File

@@ -419,6 +419,7 @@ packages:
#PKGS for Transfersh #PKGS for Transfersh
- packages: - packages:
- curl - curl
- git
action: install action: install
variants: variants:
- transfersh - transfersh

View File

@@ -26,7 +26,6 @@ pipeline {
// Setup Env // Setup Env
sh '''mkdir $WORKSPACE/REL sh '''mkdir $WORKSPACE/REL
mv distrobuilder-* distrobuilder mv distrobuilder-* distrobuilder
bash Scripts/GetExternalResources.sh
''' '''
//Check if Proxy is disabled //Check if Proxy is disabled
script{ script{

View File

@@ -1,10 +1,11 @@
#!/bin/ash #!/bin/ash
#Get Resources
curl -L --retry 7 --retry-delay 5 http://dl-4.alpinelinux.org/alpine/MIRRORS.txt -o /etc/apt-cacher-ng/alpine_mirrors
curl -L --retry 7 --retry-delay 5 https://www.centos.org/download/full-mirrorlist.csv | sed 's/^.*"http:/http:/' | sed 's/".*$//' | grep ^http > /etc/apt-cacher-ng/centos_mirrors
#Allow apt-cacher-ng to use port 80 #Allow apt-cacher-ng to use port 80
setcap 'cap_net_bind_service=+ep' /usr/sbin/apt-cacher-ng setcap 'cap_net_bind_service=+ep' /usr/sbin/apt-cacher-ng
#Move configs in place #Move configs in place
mv /opt/Setup/Configs/acng.conf /etc/apt-cacher-ng/acng.conf mv /opt/Setup/Configs/acng.conf /etc/apt-cacher-ng/acng.conf
mv /opt/Setup/centos_mirrors /etc/apt-cacher-ng/centos_mirrors
mv /opt/Setup/alpine_mirrors /etc/apt-cacher-ng/alpine_mirrors
mv /opt/Setup/Scripts/UpdateMirrorList.sh /opt/UpdateMirrorList.sh mv /opt/Setup/Scripts/UpdateMirrorList.sh /opt/UpdateMirrorList.sh
#Enable apt-cacher-ng on startup #Enable apt-cacher-ng on startup
ln -s /lib/systemd/system/apt-cacher-ng.service /etc/systemd/system/multi-user.target.wants/apt-cacher-ng.service ln -s /lib/systemd/system/apt-cacher-ng.service /etc/systemd/system/multi-user.target.wants/apt-cacher-ng.service

View File

@@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
#Get Resources
curl -L --retry 7 --retry-delay 5 https://releases.domoticz.com/releases/release/domoticz_linux_x86_64.tgz -o "/opt/Setup/domoticz.tgz"
#Adding service user #Adding service user
adduser --system --shell /bin/bash --group --disabled-password --home /home/domoticz domoticz adduser --system --shell /bin/bash --group --disabled-password --home /home/domoticz domoticz
#Crating folders #Crating folders

View File

@@ -1,4 +1,12 @@
#!/bin/bash #!/bin/bash
#Get Resources
##Duplicate get latest (Working with mono-devel )
CurrentVersion=$(curl -s https://api.github.com/repos/duplicati/duplicati/releases | grep 'tag_name.*' | grep 'beta' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |head -n 1)
##Duplicati get older version (Working with only the runtime installed)
#CurrentVersion="v2.0.5.1-2.0.5.1_beta_2020-01-18"
echo $CurrentVersion > /opt/Duplicati-installed
curl -L --retry 7 --retry-delay 5 $(curl -s https://api.github.com/repos/duplicati/duplicati/releases/tags/"$CurrentVersion" | grep browser_download_url | grep .zip |grep -v signatures | sed -e s#^.*https#https# | tr -d \") -o /opt/Setup/duplicati.zip
#Extract duplicati #Extract duplicati
unzip /opt/Setup/duplicati.zip -d /opt/duplicati unzip /opt/Setup/duplicati.zip -d /opt/duplicati
#Remove Archive #Remove Archive

View File

@@ -1,4 +1,8 @@
#!/bin/ash #!/bin/ash
#Get Resources
CurrentVersion=$(curl -s https://api.github.com/repos/elkarbackup/elkarbackup/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")
echo $CurrentVersion > /opt/Elkarbackup-installed
curl -L --retry 7 --retry-delay 5 https://github.com/elkarbackup/elkarbackup/archive/refs/tags/$CurrentVersion.tar.gz -o /opt/Setup/elkb.tar.gz
#Install Composer #Install Composer
EXPECTED_CHECKSUM="$(curl -L https://composer.github.io/installer.sig)" EXPECTED_CHECKSUM="$(curl -L https://composer.github.io/installer.sig)"
@@ -22,7 +26,6 @@ rm -f /opt/Setup/elkb.tar.gz
chown -R nginx:nginx /opt/elkarbackup chown -R nginx:nginx /opt/elkarbackup
sudo -u nginx php /opt/composer/composer.phar install -n --working-dir=/opt/elkarbackup/srv --no-dev sudo -u nginx php /opt/composer/composer.phar install -n --working-dir=/opt/elkarbackup/srv --no-dev
mv /opt/Setup/Configs/elkarbackupconf.yaml /opt/elkarbackup/srv/config/parameters.yaml mv /opt/Setup/Configs/elkarbackupconf.yaml /opt/elkarbackup/srv/config/parameters.yaml
mv /opt/Setup/Elkarbackup-installed /opt/Elkarbackup-installed
sed -i 's#/var/cache/nginx#/opt/elkarbackup/home#g' /etc/passwd sed -i 's#/var/cache/nginx#/opt/elkarbackup/home#g' /etc/passwd
mv /opt/Setup/Scripts/updateElkarbackup.sh /opt/updateElkarbackup.sh mv /opt/Setup/Scripts/updateElkarbackup.sh /opt/updateElkarbackup.sh

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
#Get Resources
curl -L --retry 7 --retry-delay 5 http://ftp.debian.org/debian/pool/main/r/rsnapshot/rsnapshot_1.4.2-1_all.deb -o /opt/Setup/rsnapshot.deb
#Install elkarbackup #Install elkarbackup
apt install /opt/Setup/rsnapshot.deb elkarbackup -y apt install /opt/Setup/rsnapshot.deb elkarbackup -y
echo "Apt intall being unable to configure elkarbackup is expected" echo "Apt intall being unable to configure elkarbackup is expected"

View File

@@ -1,4 +1,14 @@
#!/bin/ash #!/bin/ash
#Get Resources
curl -L --retry 7 --retry-delay 5 GetAddr -o /opt/Setup/File
git clone https://git.bprieshof.nl/Tools/MailBackup-sys.git /opt/Setup/MailBackup-sys
CurrentVersion=$(curl -s https://api.github.com/repos/RainLoop/rainloop-webmail/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")
OfflineIMAPVer=$(curl -s https://api.github.com/repos/OfflineIMAP/offlineimap3/tags | grep 'name.*' |head -n 1 | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")
echo $CurrentVersion > /opt/Setup/rainloop-installed
curl -L --retry 7 --retry-delay 5 http://www.rainloop.net/repository/webmail/rainloop-community-latest.zip -o /opt/Setup/rlcl.zip
echo "$OfflineIMAPVer" > CT-Files/mailbackup/OfflineIMAP3-installed
curl -L --retry 7 --retry-delay 5 https://github.com/OfflineIMAP/offlineimap3/archive/refs/tags/$OfflineIMAPVer.tar.gz -o /opt/Setup/olim3.tar.gz
#Install and configure using git.bprieshof.nl MailBackup-sys #Install and configure using git.bprieshof.nl MailBackup-sys
DistoBuilderINT=true ResourceFolder=/opt/Setup ash /opt/Setup/MailBackup-sys/install.sh DistoBuilderINT=true ResourceFolder=/opt/Setup ash /opt/Setup/MailBackup-sys/install.sh

View File

@@ -1,4 +1,9 @@
#!/bin/bash #!/bin/bash
#Get Resources
CurrentVersion=$(curl -s https://api.github.com/repos/phpmyadmin/phpmyadmin/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")
echo $CurrentVersion > /opt/phpmyadmin-installed
curl -L --retry 7 --retry-delay 5 "$GetAddr" -o "/opt/Setup/phpmyadmin.tar.gz"
#Configure MySQL #Configure MySQL
rm -rf /etc/mysql/ /etc/my.cnf.d/ /etc/my.cnf rm -rf /etc/mysql/ /etc/my.cnf.d/ /etc/my.cnf
mkdir /etc/mysql/ mkdir /etc/mysql/
@@ -11,7 +16,6 @@ tar -C /opt/PhpMyAdmin -xzf /opt/Setup/phpmyadmin.tar.gz --strip 1
rm -rf /opt/Setup/phpmyadmin.tar.gz rm -rf /opt/Setup/phpmyadmin.tar.gz
mv /opt/Setup/Configs/config.inc.php /opt/PhpMyAdmin/config.inc.php mv /opt/Setup/Configs/config.inc.php /opt/PhpMyAdmin/config.inc.php
mv /opt/Setup/Configs/phpmyadmin.service /etc/systemd/system/phpmyadmin.service mv /opt/Setup/Configs/phpmyadmin.service /etc/systemd/system/phpmyadmin.service
mv /opt/Setup/phpmyadminVersion /opt/phpmyadmin-installed
mv /opt/Setup/Scripts/UpdatePhpMyadmin.sh /opt/UpdatePhpMyadmin.sh mv /opt/Setup/Scripts/UpdatePhpMyadmin.sh /opt/UpdatePhpMyadmin.sh
chmod +x /etc/systemd/system/phpmyadmin.service chmod +x /etc/systemd/system/phpmyadmin.service
ln -s /etc/systemd/system/phpmyadmin.service /etc/systemd/system/multi-user.target.wants/phpmyadmin.service ln -s /etc/systemd/system/phpmyadmin.service /etc/systemd/system/multi-user.target.wants/phpmyadmin.service

View File

@@ -1,4 +1,7 @@
#!/bin/ash #!/bin/ash
#Get Resources
curl -L --retry 7 --retry-delay 5 https://download.nextcloud.com/server/releases/latest.tar.bz2 -o /opt/Setup/nextcloud.tar.bz2
#Configure Nginx #Configure Nginx
rm -rf /etc/nginx/conf.d rm -rf /etc/nginx/conf.d
mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf

View File

@@ -1,4 +1,7 @@
#!/bin/ash #!/bin/ash
#Get Resources
curl -L --retry 7 --retry-delay 5 https://codeload.github.com/acmesh-official/acme.sh/tar.gz/master -o /opt/Setup/Fileacmesh.tar.gz
#Configure Nginx #Configure Nginx
mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled /etc/nginx/snippets /etc/nginx/modules-available /etc/nginx/modules-enabled /etc/nginx/snippets/ mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled /etc/nginx/snippets /etc/nginx/modules-available /etc/nginx/modules-enabled /etc/nginx/snippets/
rm -rf /etc/nginx/conf.d/* rm -rf /etc/nginx/conf.d/*

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
#Install omada #Get Resources
curl -L --retry 7 --retry-delay 5 https://static.tp-link.com/2020/202012/20201225/Omada_v3.2.14_linux_x64.deb -o /opt/Setup/omada.deb
#Install Omada
apt install /opt/Setup/omada.deb -y apt install /opt/Setup/omada.deb -y
rm /opt/Setup/omada.deb rm /opt/Setup/omada.deb

View File

@@ -1,12 +1,16 @@
#!/bin/ash #!/bin/ash
#Get Resources
curl -L --retry 7 --retry-delay 5 GetAddr -o /opt/Setup/File
CurrentVersion=$(curl -s https://api.github.com/repos/dutchcoders/transfer.sh/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")
echo $CurrentVersion > /opt/transfer.sh/Version
curl -L --retry 7 --retry-delay 5 https://github.com/dutchcoders/transfer.sh/releases/download/"$CurrentVersion"/transfersh-"$CurrentVersion"-linux-amd64 -o /opt/transfer.sh/transfersh-linux-amd64
#Setup
addgroup transfersh addgroup transfersh
adduser -S -s /bin/ash -h /home/transfersh -D -G transfersh transfersh adduser -S -s /bin/ash -h /home/transfersh -D -G transfersh transfersh
mkdir -p /opt/transfer.sh/CustomTheme mkdir -p /opt/transfer.sh/CustomTheme
#Install transfer.sh custom theme #Install transfer.sh custom theme
tar -C /opt/transfer.sh/CustomTheme -xzf /opt/Setup/CustomTheme.tar.gz git clone https://git.bprieshof.nl/DarkTheme/brammp_transfer.sh-web.git /opt/transfer.sh/CustomTheme
#Install transfer.sh
mv /opt/Setup/transfersh-linux-amd64 /opt/transfer.sh/transfersh-linux-amd64
mv /opt/Setup/transfershVersion /opt/transfer.sh/Version
#Configure transfer.sh #Configure transfer.sh
mv /opt/Setup/Configs/transfersh.conf /opt/transfer.sh/transfersh.conf mv /opt/Setup/Configs/transfersh.conf /opt/transfer.sh/transfersh.conf
mv /opt/Setup/Configs/transfersh.service /etc/init.d/transfersh mv /opt/Setup/Configs/transfersh.service /etc/init.d/transfersh

View File

@@ -39,9 +39,6 @@ BuildImage () {
mv ./rootfs.tar.xz "$Distro-$Variant".tar.xz mv ./rootfs.tar.xz "$Distro-$Variant".tar.xz
} }
#Get resources
bash Scripts/GetExternalResources.sh
#Build Jenkins Image #Build Jenkins Image
BuildImage Debian jenkins BuildImage Debian jenkins
#Build JenkinsNode (imgbuilder) Image #Build JenkinsNode (imgbuilder) Image

View File

@@ -1,60 +0,0 @@
#!/bin/bash
#Goto ProjectRoot
cd "$( cd "$( dirname "$0" )" &> /dev/null && pwd )/.."
#Function Syntax/Usage
# GetResource <imageVariant> <NameDownloadedFile> <DownloadURL>
#NOTE: GetGithubRelease will set a variable with version of software as $<NameOfSoftware>Ver
# GetGithubRelease <imageVariant> <NameOfSoftware> <GithubUserName/GithubRepo> <VersionFileName>
GetResource () {
local Variant=$1
local FileName=$2
local GetAddr=$3
echo "Getting $FileName for $Variant"
curl -L --retry 7 --retry-delay 5 "$GetAddr" -o "CT-Files/$Variant/$FileName"
}
GetGithubRelease () {
#Alternative for update script: curl -s https://api.github.com/repos/<user>/<Repo>/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " "
local Variant=$1
local SoftwareName=$2
local GithubRepo=$3
local VersionFile=$4
echo "Getting $SoftwareName version for $Variant"
local CurrentVersion=$(curl -s https://api.github.com/repos/$GithubRepo/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")
export "$SoftwareName"Ver=$CurrentVersion
echo $CurrentVersion > "CT-Files/$Variant/$VersionFile"
}
GetGithubRelease mysql phpmyadmin phpmyadmin/phpmyadmin phpmyadminVersion
GetResource mysql phpmyadmin.tar.gz https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-english.tar.gz
GetResource nginx acmesh.tar.gz https://codeload.github.com/acmesh-official/acme.sh/tar.gz/master
GetResource domoticz domoticz.tgz https://releases.domoticz.com/releases/release/domoticz_linux_x86_64.tgz
GetGithubRelease transfersh transfersh dutchcoders/transfer.sh transfershVersion
GetResource transfersh transfersh-linux-amd64 https://github.com/dutchcoders/transfer.sh/releases/download/"$transfershVer"/transfersh-"$transfershVer"-linux-amd64
GetResource transfersh CustomTheme.tar.gz https://git.bprieshof.nl/attachments/217475f6-76cd-4648-be2c-7d7098f23739
GetResource omadaV3 omada.deb https://static.tp-link.com/2020/202012/20201225/Omada_v3.2.14_linux_x64.deb
GetResource nextcloud nextcloud.tar.bz2 https://download.nextcloud.com/server/releases/latest.tar.bz2
GetResource aptcacherng alpine_mirrors http://dl-4.alpinelinux.org/alpine/MIRRORS.txt
curl -L --retry 7 --retry-delay 5 https://www.centos.org/download/full-mirrorlist.csv | sed 's/^.*"http:/http:/' | sed 's/".*$//' | grep ^http > CT-Files/aptcacherng/centos_mirrors
OfflineIMAPVer=$(curl -s https://api.github.com/repos/OfflineIMAP/offlineimap3/tags | grep 'name.*' |head -n 1 | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")
echo "$OfflineIMAPVer" > CT-Files/mailbackup/OfflineIMAP3-installed
GetResource mailbackup olim3.tar.gz https://github.com/OfflineIMAP/offlineimap3/archive/refs/tags/$OfflineIMAPVer.tar.gz -o /tmp/
GetGithubRelease mailbackup elkarbackup RainLoop/rainloop-webmail rainloop-installed
GetResource mailbackup rlcl.zip http://www.rainloop.net/repository/webmail/rainloop-community-latest.zip
git clone https://git.bprieshof.nl/Tools/MailBackup-sys.git CT-Files/mailbackup/MailBackup-sys
GetResource elkarbackupDEB rsnapshot.deb http://ftp.debian.org/debian/pool/main/r/rsnapshot/rsnapshot_1.4.2-1_all.deb
GetGithubRelease elkarbackupALP elkarbackup elkarbackup/elkarbackup Elkarbackup-installed
GetResource elkarbackupALP elkb.tar.gz https://github.com/elkarbackup/elkarbackup/archive/refs/tags/$elkarbackupVer.tar.gz -o /tmp/
##Duplicate get latest (Working with mono-devel )
duplicatiVer=$(curl -s https://api.github.com/repos/duplicati/duplicati/releases | grep 'tag_name.*' | grep 'beta' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " " |head -n 1)
##Duplicati get older version (Working with only the runtime installed)
#duplicatiVer="v2.0.5.1-2.0.5.1_beta_2020-01-18"
echo $duplicatiVer > "CT-Files/duplicati/duplicati-installed"
GetResource duplicati duplicati.zip $(curl -s https://api.github.com/repos/duplicati/duplicati/releases/tags/"$duplicatiVer" | grep browser_download_url | grep .zip |grep -v signatures | sed -e s#^.*https#https# | tr -d \")