Adding self installation command for fabrica

This commit is contained in:
2021-03-23 10:47:39 +01:00
parent 740a8de4a2
commit b360760855
120 changed files with 301 additions and 164 deletions

View File

@ -0,0 +1,51 @@
#!/bin/sh
#
# downloadArchive
# ${1} : The download url
# ${2} : the checksum
# ${3} : the filename of download target
# ${4} : the checksum command to use (default sha256sum)
#
downloadArchive(){
url=${1}
sum=${2}
archive=${3}
if [ -n ${4} ]
then
checkCmd=${4}
else
checkCmd="sha256sum"
fi
wget -q ${url}
set +e
echo "${sum} ${archive}" | ${checkCmd} -cs
if [ ${?} ]
then
set -e
return 0
else
set -e
return 2
fi
}
extractArchiveXZ(){
source=${1}
destination=${2}
cmd="tar xzvf"
if [ ! -d ${destination} ]
then
mkdir -p ${destination}
fi
${cmd} ${source} -C ${destination}
return ${?}
}
cleanUpImage(){
rm -rf /var/cache/apk/*
rm -rf /tmp/*
rm -rf /root/.ssh
}