mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
Enhanced compiler script
This commit is contained in:
parent
412b447399
commit
a244f1984b
1 changed files with 228 additions and 176 deletions
|
@ -8,25 +8,24 @@ wait_to_press_enter=1
|
||||||
run_apt_update_and_install=1
|
run_apt_update_and_install=1
|
||||||
add_deb_to_apt_repo=0
|
add_deb_to_apt_repo=0
|
||||||
|
|
||||||
function press_enter {
|
DEB_NAME='buster'
|
||||||
if [ $wait_to_prss_enter -eq 1 ]; then
|
DEB_VER='10'
|
||||||
read -p "$1"
|
VESTA_VER='0.9.8-25'
|
||||||
else
|
|
||||||
echo $1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set compiling directory
|
# Set compiling directory
|
||||||
BUILD_DIR='/usr/src'
|
BUILD_DIR="/usr/src/$DEB_NAME"
|
||||||
INSTALL_DIR='/usr/local/vesta'
|
INSTALL_DIR="/usr/local/vesta/$DEB_NAME"
|
||||||
|
|
||||||
# Set git repository raw path
|
# Set git repository raw path
|
||||||
GIT_REP='https://raw.githubusercontent.com/myvesta/vesta/master/src/deb'
|
GIT_SRC='https://raw.githubusercontent.com/myvesta/vesta/master/src'
|
||||||
|
GIT_REP="$GIT_REP/deb"
|
||||||
|
|
||||||
PATH_OF_APT_REPO='/var/www/html/buster'
|
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"
|
||||||
|
|
||||||
# Set Version for compiling
|
# Set Version for compiling
|
||||||
VESTA_V='0.9.8-24_amd64'
|
VESTA_V=$VESTA_VER"_amd64"
|
||||||
NGINX_V='1.17.1'
|
NGINX_V='1.17.1'
|
||||||
OPENSSL_V='1.1.1c'
|
OPENSSL_V='1.1.1c'
|
||||||
PCRE_V='8.43'
|
PCRE_V='8.43'
|
||||||
|
@ -34,7 +33,6 @@ ZLIB_V='1.2.11'
|
||||||
PHP_V='5.6.40'
|
PHP_V='5.6.40'
|
||||||
|
|
||||||
# Generate Links for sourcecode
|
# Generate Links for sourcecode
|
||||||
VESTA='https://github.com/myvesta/vesta/archive/master.zip'
|
|
||||||
NGINX='https://nginx.org/download/nginx-'$NGINX_V'.tar.gz'
|
NGINX='https://nginx.org/download/nginx-'$NGINX_V'.tar.gz'
|
||||||
OPENSSL='https://www.openssl.org/source/openssl-'$OPENSSL_V'.tar.gz'
|
OPENSSL='https://www.openssl.org/source/openssl-'$OPENSSL_V'.tar.gz'
|
||||||
PCRE='https://ftp.pcre.org/pub/pcre/pcre-'$PCRE_V'.tar.gz'
|
PCRE='https://ftp.pcre.org/pub/pcre/pcre-'$PCRE_V'.tar.gz'
|
||||||
|
@ -42,7 +40,38 @@ ZLIB='https://www.zlib.net/zlib-'$ZLIB_V'.tar.gz'
|
||||||
PHP='http://de2.php.net/distributions/php-'$PHP_V'.tar.gz'
|
PHP='http://de2.php.net/distributions/php-'$PHP_V'.tar.gz'
|
||||||
|
|
||||||
# Set package dependencies for compiling
|
# Set package dependencies for compiling
|
||||||
SOFTWARE='build-essential libxml2-dev libz-dev libcurl4-gnutls-dev unzip openssl libssl-dev pkg-config'
|
SOFTWARE='build-essential libxml2-dev libz-dev libcurl4-gnutls-dev unzip openssl libssl-dev pkg-config reprepro dpkg-sig'
|
||||||
|
|
||||||
|
function press_enter {
|
||||||
|
if [ $wait_to_press_enter -eq 1 ]; then
|
||||||
|
read -p "$1"
|
||||||
|
else
|
||||||
|
echo $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_deb_package_and_add_to_repo {
|
||||||
|
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
|
||||||
|
press_enter "=== Press enter to sign the package ==============================================================================="
|
||||||
|
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
dpkg-sig --sign builder $1_$VESTA_V.deb
|
||||||
|
mkdir -p $PATH_OF_APT_REPO
|
||||||
|
cd $PATH_OF_APT_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
|
||||||
|
}
|
||||||
|
|
||||||
# Install needed software
|
# Install needed software
|
||||||
if [ $run_apt_update_and_install -eq 1 ]; then
|
if [ $run_apt_update_and_install -eq 1 ]; then
|
||||||
|
@ -67,6 +96,9 @@ for arg; do
|
||||||
NGINX_B='true'
|
NGINX_B='true'
|
||||||
PHP_B='true'
|
PHP_B='true'
|
||||||
VESTA_B='true'
|
VESTA_B='true'
|
||||||
|
VESTAGIT_B='true'
|
||||||
|
CWEB_B='true'
|
||||||
|
APTWEB_B='true'
|
||||||
;;
|
;;
|
||||||
--nginx)
|
--nginx)
|
||||||
NGINX_B='true'
|
NGINX_B='true'
|
||||||
|
@ -77,17 +109,99 @@ for arg; do
|
||||||
--vesta)
|
--vesta)
|
||||||
VESTA_B='true'
|
VESTA_B='true'
|
||||||
;;
|
;;
|
||||||
|
--vestagit)
|
||||||
|
VESTAGIT_B='true'
|
||||||
|
;;
|
||||||
|
--cweb)
|
||||||
|
CWEB_B='true'
|
||||||
|
;;
|
||||||
|
--aptweb)
|
||||||
|
APTWEB_B='true'
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
NOARGUMENT='true'
|
NOARGUMENT='true'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $# -eq 0 ]] ; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "!!! Please run with argument --all, --vesta, --nginx or --php !!!"
|
echo "!!! Please run with argument --vesta, --nginx, --php, --vestagit, --cweb, --aptweb or --all"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$CWEB_B" = true ]; then
|
||||||
|
VESTAGIT_B='true'
|
||||||
|
fi
|
||||||
|
if [ "$VESTA_B" = true ]; then
|
||||||
|
VESTAGIT_B='true'
|
||||||
|
fi
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
#
|
||||||
|
# Get latest vesta from git
|
||||||
|
#
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
|
if [ "$VESTAGIT_B" = true ]; then
|
||||||
|
echo "======= Get latest vesta from git ======="
|
||||||
|
cd /root
|
||||||
|
rm -rf vesta/
|
||||||
|
git clone https://github.com/myvesta/vesta.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
#
|
||||||
|
# Building c subdomain web folder
|
||||||
|
#
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
|
if [ "$CWEB_B" = true ]; then
|
||||||
|
echo "======= Building c subdomain web folder ======="
|
||||||
|
|
||||||
|
echo "Removing: $PATH_OF_C_WEB_FOLDER"
|
||||||
|
rm -rf $PATH_OF_C_WEB_FOLDER
|
||||||
|
echo "=== Whole C folder removed"
|
||||||
|
|
||||||
|
echo "=== Making folder $PATH_OF_C_WEB_FOLDER"
|
||||||
|
mkdir -p $PATH_OF_C_WEB_FOLDER
|
||||||
|
cd $PATH_OF_C_WEB_FOLDER
|
||||||
|
|
||||||
|
echo "=== Copying and extracting static files"
|
||||||
|
|
||||||
|
cp /root/vesta/src/static.tar.gz $PATH_OF_C_WEB_FOLDER/static.tar.gz
|
||||||
|
tar -xzf static.tar.gz
|
||||||
|
rm static.tar.gz
|
||||||
|
|
||||||
|
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
|
||||||
|
cd $PATH_OF_C_WEB_FOLDER_FOR_SPECIFIC_DEB_VER
|
||||||
|
|
||||||
|
if [ -f "packages.tar.gz" ]; then
|
||||||
|
rm packages.tar.gz
|
||||||
|
fi
|
||||||
|
tar -czf packages.tar.gz packages/
|
||||||
|
|
||||||
|
if [ -f "templates.tar.gz" ]; then
|
||||||
|
rm templates.tar.gz
|
||||||
|
fi
|
||||||
|
tar -czf templates.tar.gz templates/
|
||||||
|
|
||||||
|
if [ -f "firewall.tar.gz" ]; then
|
||||||
|
rm firewall.tar.gz
|
||||||
|
fi
|
||||||
|
tar -czf firewall.tar.gz firewall/
|
||||||
|
|
||||||
|
if [ -f "fail2ban.tar.gz" ]; then
|
||||||
|
rm fail2ban.tar.gz
|
||||||
|
fi
|
||||||
|
tar -czf fail2ban.tar.gz fail2ban/
|
||||||
|
|
||||||
|
if [ -f "dovecot.tar.gz" ]; then
|
||||||
|
rm dovecot.tar.gz
|
||||||
|
fi
|
||||||
|
tar -czf dovecot.tar.gz dovecot/
|
||||||
|
fi
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
#
|
#
|
||||||
|
@ -95,7 +209,7 @@ fi
|
||||||
#
|
#
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
if [ "$NGINX_B" = true ] ; then
|
if [ "$NGINX_B" = true ]; then
|
||||||
echo "======= Building vesta-nginx ======="
|
echo "======= Building vesta-nginx ======="
|
||||||
|
|
||||||
echo "=== Change to build directory"
|
echo "=== Change to build directory"
|
||||||
|
@ -103,16 +217,15 @@ if [ "$NGINX_B" = true ] ; then
|
||||||
|
|
||||||
BUILDING_NOW=0
|
BUILDING_NOW=0
|
||||||
# Check if target directory exist
|
# Check if target directory exist
|
||||||
if [ ! -d $BUILD_DIR/vesta-nginx_$VESTA_V ]; then
|
if [ ! -d "$BUILD_DIR/nginx-$NGINX_V" ] || [ ! -d "$INSTALL_DIR/nginx" ]; then
|
||||||
#mv $BUILD_DIR/vesta-nginx_$VESTA_V $BUILD_DIR/vesta-nginx_$VESTA_V-$(timestamp)
|
|
||||||
# rm -r $BUILD_DIR/vesta-nginx_$VESTA_V
|
|
||||||
# fi
|
|
||||||
|
|
||||||
BUILDING_NOW=1
|
BUILDING_NOW=1
|
||||||
echo "=== Create directory"
|
|
||||||
mkdir $BUILD_DIR/vesta-nginx_$VESTA_V
|
|
||||||
|
|
||||||
press_enter "=== Download and unpack source files"
|
press_enter "=== Press enter to download and unpack source files"
|
||||||
|
|
||||||
|
rm -rf nginx-$NGINX_V
|
||||||
|
rm -rf openssl-$OPENSSL_V
|
||||||
|
rm -rf pcre-$PCRE_V
|
||||||
|
rm -rf zlib-$ZLIB_V
|
||||||
wget -nv -qO- $NGINX | tar xz
|
wget -nv -qO- $NGINX | tar xz
|
||||||
wget -nv -qO- $OPENSSL | tar xz
|
wget -nv -qO- $OPENSSL | tar xz
|
||||||
wget -nv -qO- $PCRE | tar xz
|
wget -nv -qO- $PCRE | tar xz
|
||||||
|
@ -122,7 +235,7 @@ if [ "$NGINX_B" = true ] ; then
|
||||||
cd nginx-$NGINX_V
|
cd nginx-$NGINX_V
|
||||||
|
|
||||||
press_enter "=== Press enter to configure nginx"
|
press_enter "=== Press enter to configure nginx"
|
||||||
./configure --prefix=/usr/local/vesta/nginx \
|
./configure --prefix=$INSTALL_DIR/nginx \
|
||||||
--with-http_ssl_module \
|
--with-http_ssl_module \
|
||||||
--with-openssl=../openssl-$OPENSSL_V \
|
--with-openssl=../openssl-$OPENSSL_V \
|
||||||
--with-openssl-opt=enable-ec_nistp_64_gcc_128 \
|
--with-openssl-opt=enable-ec_nistp_64_gcc_128 \
|
||||||
|
@ -133,71 +246,56 @@ if [ "$NGINX_B" = true ] ; then
|
||||||
--with-pcre-jit \
|
--with-pcre-jit \
|
||||||
--with-zlib=../zlib-$ZLIB_V
|
--with-zlib=../zlib-$ZLIB_V
|
||||||
|
|
||||||
# Check install directory and move if exists
|
# Check install directory and remove if exists
|
||||||
if [ -d $INSTALL_DIR ]; then
|
if [ -d $INSTALL_DIR/nginx ]; then
|
||||||
#mv $INSTALL_DIR $INSTALL_DIR$(timestamp)
|
rm -rf $INSTALL_DIR/nginx
|
||||||
rm -r $INSTALL_DIR
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
press_enter "=== Press enter to make && make install"
|
press_enter "=== Press enter to make && make install"
|
||||||
make && make install
|
make && make install
|
||||||
|
|
||||||
press_enter "=== Press enter to clear up unused files"
|
|
||||||
cd $BUILD_DIR
|
|
||||||
rm -r nginx-$NGINX_V openssl-$OPENSSL_V pcre-$PCRE_V zlib-$ZLIB_V
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
press_enter "=== Press enter to Prepare Deb Package Folder Structure"
|
press_enter "=== Press enter to Prepare Deb Package Folder Structure"
|
||||||
cd vesta-nginx_$VESTA_V/
|
if [ -d "$BUILD_DIR/vesta-nginx_$VESTA_V" ]; then
|
||||||
mkdir -p usr/local/vesta etc/init.d DEBIAN
|
rm -rf $BUILD_DIR/vesta-nginx_$VESTA_V
|
||||||
|
fi
|
||||||
|
echo "=== Create directory"
|
||||||
|
mkdir $BUILD_DIR/vesta-nginx_$VESTA_V
|
||||||
|
|
||||||
|
cd $BUILD_DIR/vesta-nginx_$VESTA_V/
|
||||||
|
mkdir -p usr/local/vesta/nginx etc/init.d DEBIAN
|
||||||
|
|
||||||
press_enter "=== Press enter to Download control, postinst and postrm files"
|
press_enter "=== Press enter to Download control, postinst and postrm files"
|
||||||
cd DEBIAN
|
# Copying control, postinst and postrm files
|
||||||
wget -nv $GIT_REP/nginx/control -O control
|
cp -rf /root/vesta/src/deb/nginx/* $BUILD_DIR/vesta-nginx_$VESTA_V/DEBIAN
|
||||||
wget -nv $GIT_REP/nginx/copyright -O copyright
|
rm $BUILD_DIR/vesta-nginx_$VESTA_V/DEBIAN/nginx.conf
|
||||||
wget -nv $GIT_REP/nginx/postinst -O postinst
|
rm $BUILD_DIR/vesta-nginx_$VESTA_V/DEBIAN/vesta
|
||||||
wget -nv $GIT_REP/nginx/postrm -O postrm
|
|
||||||
chmod +x postinst postrm
|
|
||||||
|
|
||||||
cd ..
|
# Set version
|
||||||
if [ $BUILDING_NOW -eq 1 ]; then
|
sed -i "/Version: /c\Version: $VESTA_VER" $BUILD_DIR/vesta-nginx_$VESTA_V/DEBIAN/control
|
||||||
echo "=== Move nginx directory"
|
|
||||||
mv /usr/local/vesta/nginx usr/local/vesta/
|
# Set permission
|
||||||
fi
|
chmod +x $BUILD_DIR/vesta-nginx_$VESTA_V/DEBIAN/postinst
|
||||||
|
|
||||||
|
echo "=== Copying nginx directory"
|
||||||
|
cp -rf $INSTALL_DIR/nginx/* usr/local/vesta/nginx
|
||||||
|
|
||||||
echo "=== Get Service File"
|
echo "=== Get Service File"
|
||||||
cd etc/init.d
|
cd $BUILD_DIR/vesta-nginx_$VESTA_V/etc/init.d
|
||||||
wget -nv $GIT_REP/nginx/vesta
|
cp /root/vesta/src/deb/nginx/vesta vesta
|
||||||
chmod +x vesta
|
chmod +x vesta
|
||||||
|
|
||||||
echo "=== Get nginx.conf"
|
echo "=== Get nginx.conf"
|
||||||
cd ../../
|
cd $BUILD_DIR/vesta-nginx_$VESTA_V
|
||||||
wget -nv $GIT_REP/nginx/nginx.conf -O usr/local/vesta/nginx/conf/nginx.conf
|
cp /root/vesta/src/deb/nginx/nginx.conf $BUILD_DIR/vesta-nginx_$VESTA_V/usr/local/vesta/nginx/conf/nginx.conf
|
||||||
|
|
||||||
if [ $BUILDING_NOW -eq 1 ]; then
|
# if [ $BUILDING_NOW -eq 1 ]; then
|
||||||
echo "=== copy binary"
|
echo "=== copy binary"
|
||||||
cp usr/local/vesta/nginx/sbin/nginx usr/local/vesta/nginx/sbin/vesta-nginx
|
cp $INSTALL_DIR/nginx/sbin/nginx $BUILD_DIR/vesta-nginx_$VESTA_V/usr/local/vesta/nginx/sbin/vesta-nginx
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
press_enter "=== Press enter to build the package"
|
make_deb_package_and_add_to_repo "vesta-nginx"
|
||||||
cd /usr/src
|
|
||||||
dpkg-deb --build vesta-nginx_$VESTA_V
|
|
||||||
|
|
||||||
if [ $add_deb_to_apt_repo -eq 1 ]; then
|
|
||||||
press_enter "=== Press enter to sign the package ==============================================================================="
|
|
||||||
|
|
||||||
export GPG_TTY=$(tty)
|
|
||||||
dpkg-sig --sign builder vesta-nginx_$VESTA_V.deb
|
|
||||||
cd $PATH_OF_APT_REPO
|
|
||||||
|
|
||||||
press_enter "=== Press enter to add to repo ==============================================================================="
|
|
||||||
|
|
||||||
reprepro --ask-passphrase -Vb . remove buster vesta-nginx
|
|
||||||
reprepro --ask-passphrase -Vb . includedeb buster $BUILD_DIR/vesta-nginx_$VESTA_V.deb
|
|
||||||
fi
|
|
||||||
|
|
||||||
# clear up the source folder
|
|
||||||
# rm -r vesta-nginx_$VESTA_V
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
@ -207,23 +305,17 @@ fi
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
|
||||||
if [ "$PHP_B" = true ] ; then
|
if [ "$PHP_B" = true ]; then
|
||||||
echo "======= Building vesta-php ======="
|
echo "======= Building vesta-php package ======="
|
||||||
echo "=== Change to build directory: $BUILD_DIR"
|
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
|
|
||||||
BUILDING_NOW=0
|
BUILDING_NOW=0
|
||||||
# Check if target directory exist
|
# Check if target directory exist
|
||||||
if [ ! -d $BUILD_DIR/vesta-php_$VESTA_V ]; then
|
if [ ! -d "$BUILD_DIR/php-$PHP_V" ] || [ ! -d "$INSTALL_DIR/nginx" ]; then
|
||||||
# #mv $BUILD_DIR/vesta-php_$VESTA_V $BUILD_DIR/vesta-php_$VESTA_V-$(timestamp)
|
|
||||||
# rm -r $BUILD_DIR/vesta-php_$VESTA_V
|
|
||||||
# fi
|
|
||||||
BUILDING_NOW=1
|
BUILDING_NOW=1
|
||||||
|
|
||||||
echo "=== Create directory: $BUILD_DIR/vesta-php_$VESTA_V"
|
|
||||||
mkdir $BUILD_DIR/vesta-php_$VESTA_V
|
|
||||||
|
|
||||||
echo "=== Download and unpack source files"
|
echo "=== Download and unpack source files"
|
||||||
|
rm -rf php-$PHP_V
|
||||||
wget -nv -qO- $PHP | tar xz
|
wget -nv -qO- $PHP | tar xz
|
||||||
|
|
||||||
echo "=== Change to php directory php-$PHP_V"
|
echo "=== Change to php directory php-$PHP_V"
|
||||||
|
@ -232,7 +324,7 @@ if [ "$PHP_B" = true ] ; then
|
||||||
press_enter "=== Press enter to continue ==============================================================================="
|
press_enter "=== Press enter to continue ==============================================================================="
|
||||||
|
|
||||||
echo "=== Configure PHP"
|
echo "=== Configure PHP"
|
||||||
./configure --prefix=/usr/local/vesta/php \
|
./configure --prefix=$INSTALL_DIR/php \
|
||||||
--enable-fpm \
|
--enable-fpm \
|
||||||
--with-zlib \
|
--with-zlib \
|
||||||
--with-fpm-user=admin \
|
--with-fpm-user=admin \
|
||||||
|
@ -242,69 +334,55 @@ if [ "$PHP_B" = true ] ; then
|
||||||
--with-curl \
|
--with-curl \
|
||||||
--enable-mbstring
|
--enable-mbstring
|
||||||
|
|
||||||
press_enter "=== Press enter to Create the files and install them ==============================================================================="
|
# Check install directory and remove if exists
|
||||||
|
if [ -d $INSTALL_DIR/php ]; then
|
||||||
|
rm -rf $INSTALL_DIR/php
|
||||||
|
fi
|
||||||
|
|
||||||
|
press_enter "=== Press enter to create the files and install them ==============================================================================="
|
||||||
|
|
||||||
make && make install
|
make && make install
|
||||||
|
|
||||||
press_enter "=== Press enter to continue ==============================================================================="
|
press_enter "=== Press enter to continue ==============================================================================="
|
||||||
|
|
||||||
echo "=== Clear up unused files: $BUILD_DIR/php-$PHP_V"
|
|
||||||
cd $BUILD_DIR
|
|
||||||
rm -r php-$PHP_V
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Prepare Deb Package Folder Structure: $BUILD_DIR/vesta-php_$VESTA_V/usr/local/vesta and $BUILD_DIR/vesta-php_$VESTA_V/DEBIAN"
|
cd $BUILD_DIR
|
||||||
cd vesta-php_$VESTA_V/
|
if [ -d "vesta-php_$VESTA_V" ]; then
|
||||||
|
rm -rf vesta-php_$VESTA_V
|
||||||
|
fi
|
||||||
|
echo "=== Create directory: $BUILD_DIR/vesta-php_$VESTA_V"
|
||||||
|
mkdir -p $BUILD_DIR/vesta-php_$VESTA_V
|
||||||
|
|
||||||
|
echo "=== Prepare Deb Package Folder Structure: $BUILD_DIR/vesta-php_$VESTA_V/usr/local/vesta/php and $BUILD_DIR/vesta-php_$VESTA_V/DEBIAN"
|
||||||
|
cd $BUILD_DIR/vesta-php_$VESTA_V/
|
||||||
mkdir -p usr/local/vesta/php DEBIAN
|
mkdir -p usr/local/vesta/php DEBIAN
|
||||||
|
|
||||||
echo "=== Download control, postinst and postrm files"
|
# Copying control, postinst and postrm files
|
||||||
cd DEBIAN
|
cp -rf /root/vesta/src/deb/php/* $BUILD_DIR/vesta-php_$VESTA_V/DEBIAN
|
||||||
wget -nv $GIT_REP/php/postinst -O postinst
|
rm $BUILD_DIR/vesta-php_$VESTA_V/DEBIAN/php-fpm.conf
|
||||||
chmod 0755 postinst
|
|
||||||
wget -nv $GIT_REP/php/control -O control
|
|
||||||
wget -nv $GIT_REP/php/copyright -O copyright
|
|
||||||
|
|
||||||
press_enter "=== Press enter to move php directory ==============================================================================="
|
# Set version
|
||||||
|
sed -i "/Version: /c\Version: $VESTA_VER" $BUILD_DIR/vesta-php_$VESTA_V/DEBIAN/control
|
||||||
|
|
||||||
|
# Set permission
|
||||||
|
chmod +x $BUILD_DIR/vesta-php_$VESTA_V/DEBIAN/postinst
|
||||||
|
|
||||||
|
press_enter "=== Press enter to copy builded php ==============================================================================="
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
if [ $BUILDING_NOW -eq 1 ]; then
|
# if [ $BUILDING_NOW -eq 1 ]; then
|
||||||
echo "=== Moving php directory"
|
echo "=== Copying php directory"
|
||||||
mv /usr/local/vesta/php usr/local/vesta/
|
cp -rf $INSTALL_DIR/php/* $BUILD_DIR/vesta-php_$VESTA_V/usr/local/vesta/php/
|
||||||
press_enter "=== Done, press enter ==============================================================================="
|
press_enter "=== Done, press enter to copy php-fpm.conf and vesta-php binary ==============================================================================="
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "=== Get php-fpm.conf"
|
echo "=== Get php-fpm.conf"
|
||||||
wget -nv $GIT_REP/php/php-fpm.conf -O usr/local/vesta/php/etc/php-fpm.conf
|
cp /root/vesta/src/deb/php/php-fpm.conf $BUILD_DIR/vesta-php_$VESTA_V/usr/local/vesta/php/etc/php-fpm.conf
|
||||||
|
|
||||||
if [ $BUILDING_NOW -eq 1 ]; then
|
echo "=== copy binary"
|
||||||
echo "=== copy binary"
|
cp $INSTALL_DIR/php/sbin/php-fpm $BUILD_DIR/vesta-php_$VESTA_V/usr/local/vesta/php/sbin/vesta-php
|
||||||
cp usr/local/vesta/php/sbin/php-fpm usr/local/vesta/php/sbin/vesta-php
|
|
||||||
fi
|
|
||||||
|
|
||||||
press_enter "=== Press enter to build the package ==============================================================================="
|
make_deb_package_and_add_to_repo "vesta-php"
|
||||||
|
|
||||||
echo "=== build the package"
|
|
||||||
cd /usr/src
|
|
||||||
if [ -f "vesta-php_$VESTA_V.deb" ]; then
|
|
||||||
rm vesta-php_$VESTA_V.deb
|
|
||||||
fi
|
|
||||||
dpkg-deb --build vesta-php_$VESTA_V
|
|
||||||
|
|
||||||
if [ $add_deb_to_apt_repo -eq 1 ]; then
|
|
||||||
press_enter "=== Press enter to sign the package ==============================================================================="
|
|
||||||
|
|
||||||
export GPG_TTY=$(tty)
|
|
||||||
dpkg-sig --sign builder vesta-php_$VESTA_V.deb
|
|
||||||
|
|
||||||
press_enter "=== Press enter to add to repo ==============================================================================="
|
|
||||||
|
|
||||||
cd $PATH_OF_APT_REPO
|
|
||||||
reprepro --ask-passphrase -Vb . remove buster vesta-php
|
|
||||||
reprepro --ask-passphrase -Vb . includedeb buster $BUILD_DIR/vesta-php_$VESTA_V.deb
|
|
||||||
fi
|
|
||||||
|
|
||||||
# clear up the source folder
|
|
||||||
# rm -r vesta-php_$VESTA_V
|
|
||||||
|
|
||||||
echo "=== All done"
|
echo "=== All done"
|
||||||
fi
|
fi
|
||||||
|
@ -315,67 +393,41 @@ fi
|
||||||
#
|
#
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
if [ "$VESTA_B" = true ] ; then
|
if [ "$VESTA_B" = true ]; then
|
||||||
|
echo "======= Building vesta package ======="
|
||||||
# Change to build directory
|
# Change to build directory
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
|
|
||||||
# Check if target directory exist
|
# Check if target directory exist
|
||||||
if [ -d $BUILD_DIR/vesta_$VESTA_V ]; then
|
if [ -d $BUILD_DIR/vesta_$VESTA_V ]; then
|
||||||
rm -r $BUILD_DIR/vesta_$VESTA_V
|
rm -rf $BUILD_DIR/vesta_$VESTA_V
|
||||||
fi
|
|
||||||
if [ -d $BUILD_DIR/vesta-master ]; then
|
|
||||||
rm -r $BUILD_DIR/vesta-master
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create directory
|
# Create directory
|
||||||
mkdir $BUILD_DIR/vesta_$VESTA_V
|
mkdir $BUILD_DIR/vesta_$VESTA_V
|
||||||
|
|
||||||
# Download and unpack source files
|
|
||||||
wget -nv $VESTA
|
|
||||||
unzip -q master.zip
|
|
||||||
rm master.zip
|
|
||||||
|
|
||||||
# Prepare Deb Package Folder Structure
|
# Prepare Deb Package Folder Structure
|
||||||
cd vesta_$VESTA_V/
|
cd vesta_$VESTA_V/
|
||||||
mkdir -p usr/local/vesta DEBIAN
|
mkdir -p usr/local/vesta DEBIAN
|
||||||
|
|
||||||
# Download control, postinst and postrm files
|
# Copying control, postinst and postrm files
|
||||||
cd DEBIAN
|
cp -rf /root/vesta/src/deb/vesta/* $BUILD_DIR/vesta_$VESTA_V/DEBIAN
|
||||||
wget -nv $GIT_REP/vesta/control
|
|
||||||
wget -nv $GIT_REP/vesta/copyright
|
# Set version
|
||||||
wget -nv $GIT_REP/vesta/postinst
|
sed -i "/Version: /c\Version: $VESTA_VER" $BUILD_DIR/vesta_$VESTA_V/DEBIAN/control
|
||||||
|
|
||||||
# Set permission
|
# Set permission
|
||||||
chmod +x postinst
|
chmod +x $BUILD_DIR/vesta_$VESTA_V/DEBIAN/postinst
|
||||||
|
rm $BUILD_DIR/vesta_$VESTA_V/DEBIAN/conffiles
|
||||||
|
|
||||||
# Move needed directories
|
# Copying vesta source
|
||||||
cd $BUILD_DIR/vesta-master
|
cp -rf /root/vesta/* $BUILD_DIR/vesta_$VESTA_V/usr/local/vesta
|
||||||
mv bin func install upd web $BUILD_DIR/vesta_$VESTA_V/usr/local/vesta/
|
|
||||||
|
|
||||||
# Set permission
|
# Set permission
|
||||||
cd $BUILD_DIR/vesta_$VESTA_V/usr/local/vesta/bin
|
cd $BUILD_DIR/vesta_$VESTA_V/usr/local/vesta/bin
|
||||||
chmod +x *
|
chmod +x *
|
||||||
|
cd $BUILD_DIR/vesta_$VESTA_V/usr/local/vesta/upd
|
||||||
|
chmod +x *
|
||||||
|
|
||||||
press_enter "=== Press enter to build the package ==============================================================================="
|
make_deb_package_and_add_to_repo "vesta"
|
||||||
# build the package
|
|
||||||
cd /usr/src
|
|
||||||
dpkg-deb --build vesta_$VESTA_V
|
|
||||||
|
|
||||||
if [ $add_deb_to_apt_repo -eq 1 ]; then
|
|
||||||
press_enter "=== Press enter to sign the package ==============================================================================="
|
|
||||||
|
|
||||||
export GPG_TTY=$(tty)
|
|
||||||
dpkg-sig --sign builder vesta_$VESTA_V.deb
|
|
||||||
|
|
||||||
press_enter "=== Press enter to add to repo ==============================================================================="
|
|
||||||
|
|
||||||
cd $PATH_OF_APT_REPO
|
|
||||||
reprepro --ask-passphrase -Vb . remove buster vesta
|
|
||||||
reprepro --ask-passphrase -Vb . includedeb buster $BUILD_DIR/vesta_$VESTA_V.deb
|
|
||||||
fi
|
|
||||||
|
|
||||||
# clear up the source folder
|
|
||||||
cd /usr/src
|
|
||||||
rm -r vesta_$VESTA_V
|
|
||||||
rm -r vesta-master
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue