Update vesta_compile.sh

This commit is contained in:
dpeca 2019-08-17 01:50:55 +02:00 committed by GitHub
commit 48e6e497da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,18 +7,20 @@
build_deb_package=1
add_deb_to_apt_repo=0
DEB_NAME='buster'
TARGET_DEB_NAME='buster'
DEB_VER='10'
VESTA_VER='0.9.8-25'
MAIN_TARGET_DEB_NAME='buster'
TARGET_DEB_NAME_MAIN='buster'
run_apt_update_and_install=1
wait_to_press_enter=1
###############
# Set compiling directory
BUILD_DIR="/usr/src/$DEB_NAME"
BUILD_DIR="/usr/src/$TARGET_DEB_NAME"
BUILD_DIR_MAIN="/usr/src/$TARGET_DEB_NAME_MAIN"
INSTALL_DIR="/usr/local/vesta"
# Set git repository raw path
@ -26,8 +28,8 @@ GIT_SRC='https://raw.githubusercontent.com/myvesta/vesta/master/src'
GIT_REP="$GIT_REP/deb"
PATH_OF_C_WEB_FOLDER="/var/www/c.vesta.hostingpanel.dev/html"
PATH_OF_C_WEB_FOLDER_FOR_SPECIFIC_DEB_VER="$PATH_OF_C_WEB_FOLDER/debian/$DEB_VER"
PATH_OF_APT_REPO="/var/www/apt.vesta.hostingpanel.dev/html/$DEB_NAME"
PATH_OF_C_WEB_FOLDER_FOR_SPECIFIC_DEB_VER="$PATH_OF_C_WEB_FOLDER/debian/$TARGET_DEB_VER"
PATH_OF_APT_REPO="/var/www/apt.vesta.hostingpanel.dev/html/$TARGET_DEB_NAME"
# Set Version for compiling
VESTA_V=$VESTA_VER"_amd64"
@ -55,17 +57,18 @@ function press_enter {
fi
}
function make_deb_package_and_add_to_repo {
function make_deb_package {
press_enter "=== Press enter to build the package"
cd $BUILD_DIR
if [ -f "$1_$VESTA_V.deb" ]; then
rm $1_$VESTA_V.deb
fi
dpkg-deb --build $1_$VESTA_V
}
if [ $add_deb_to_apt_repo -eq 1 ]; then
function add_to_repo {
press_enter "=== Press enter to sign the package ==============================================================================="
cd $BUILD_DIR
export GPG_TTY=$(tty)
dpkg-sig --sign builder $1_$VESTA_V.deb
mkdir -p $PATH_OF_APT_REPO
@ -73,9 +76,8 @@ function make_deb_package_and_add_to_repo {
press_enter "=== Press enter to add to repo ==============================================================================="
reprepro --ask-passphrase -Vb . remove $DEB_NAME $1
reprepro --ask-passphrase -Vb . includedeb $DEB_NAME $BUILD_DIR/$1_$VESTA_V.deb
fi
reprepro --ask-passphrase -Vb . remove $TARGET_DEB_NAME $1
reprepro --ask-passphrase -Vb . includedeb $TARGET_DEB_NAME $BUILD_DIR/$1_$VESTA_V.deb
}
# Install needed software
@ -189,7 +191,7 @@ if [ "$CWEB_B" = true ]; then
echo "=== Copying files"
mkdir -p $PATH_OF_C_WEB_FOLDER_FOR_SPECIFIC_DEB_VER
cp -rf /root/vesta/install/debian/$DEB_VER/* $PATH_OF_C_WEB_FOLDER_FOR_SPECIFIC_DEB_VER
cp -rf /root/vesta/install/debian/$TARGET_DEB_VER/* $PATH_OF_C_WEB_FOLDER_FOR_SPECIFIC_DEB_VER
cp /root/vesta/install/debian/10/deb_signing.key /var/www/c.vesta.hostingpanel.dev/html/deb_signing.key
cd $PATH_OF_C_WEB_FOLDER_FOR_SPECIFIC_DEB_VER
@ -226,6 +228,7 @@ fi
#################################################################################
if [ "$NGINX_B" = true ]; then
if [ $build_deb_package -eq 1 ]; then
echo "======= Building vesta-nginx ======="
echo "=== Change to build directory"
@ -311,7 +314,11 @@ if [ "$NGINX_B" = true ]; then
cp $INSTALL_DIR/nginx/sbin/nginx $BUILD_DIR/vesta-nginx_$VESTA_V/usr/local/vesta/nginx/sbin/vesta-nginx
# fi
make_deb_package_and_add_to_repo "vesta-nginx"
make_deb_package "vesta-nginx"
fi
if [ $add_deb_to_apt_repo -eq 1 ]; then
add_to_repo "vesta-nginx"
fi
echo "=== All done"
fi
@ -324,6 +331,7 @@ fi
if [ "$PHP_B" = true ]; then
if [ $build_deb_package -eq 1 ]; then
echo "======= Building vesta-php package ======="
cd $BUILD_DIR
@ -402,7 +410,11 @@ if [ "$PHP_B" = true ]; then
echo "=== copy binary"
cp $INSTALL_DIR/php/sbin/php-fpm $BUILD_DIR/vesta-php_$VESTA_V/usr/local/vesta/php/sbin/vesta-php
make_deb_package_and_add_to_repo "vesta-php"
make_deb_package "vesta-php"
fi
if [ $add_deb_to_apt_repo -eq 1 ]; then
add_to_repo "vesta-php"
fi
echo "=== All done"
fi
@ -414,6 +426,7 @@ fi
#################################################################################
if [ "$VESTA_B" = true ]; then
if [ $build_deb_package -eq 1 ]; then
echo "======= Building vesta package ======="
# Change to build directory
cd $BUILD_DIR
@ -449,7 +462,16 @@ if [ "$VESTA_B" = true ]; then
cd $BUILD_DIR/vesta_$VESTA_V/usr/local/vesta/upd
chmod +x *
make_deb_package_and_add_to_repo "vesta"
make_deb_package "vesta"
fi
if [ $add_deb_to_apt_repo -eq 1 ]; then
if [ "$TARGET_DEB_NAME_MAIN" != "$TARGET_DEB_NAME" ]; then
cd $BUILD_DIR
rm vesta_$VESTA_V.deb
cp $BUILD_DIR_MAIN/vesta_$VESTA_V.deb $BUILD_DIR/vesta_$VESTA_V.deb
fi
add_to_repo "vesta"
fi
echo "=== All done"
fi