ubuntu1c-autoinstall/download-1c.sh
2022-10-28 14:58:52 +03:00

73 lines
1002 B
Bash
Executable File

#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
make_folder () {
rm -rf ./tmp
mkdir ./tmp
}
install_oneget() {
go install github.com/v8platform/oneget@latest
export PATH=$PATH:"~/go/bin"
}
download_1c_distr() {
oneget get --path $1 platform:linux.x64@latest
}
find_1c_distr() {
find $1 -name "server64*.tar.gz" -type f
}
cleanup() {
rm -rf ./tmp
}
pushd $SCRIPT_DIR
DISTR_1C=$(find_1c_distr ./distr)
if [[ -r "$DISTR_1C" ]]
then
echo "remove 1c distr first"
echo $DISTR_1C
popd
exit 1
fi
# import
# ONEC_USERNAME
# ONEC_PASSWORD
ENV_FILE="../portal-1c.env"
if [[ -r "$ENV_FILE" ]]
then
. $ENV_FILE
else
echo "no env vars file"
popd
exit 1
fi
make_folder
download_1c_distr ./tmp
DISTR_1C=$(find_1c_distr ./tmp)
if [[ ! -r "$DISTR_1C" ]]
then
echo "downloaded distr not found"
popd
exit 1
fi
mv $DISTR_1C ./distr/
cleanup
DISTR_1C=$(find_1c_distr ./distr)
echo $DISTR_1C
popd