Add --debian-only option to build.sh for rebuilding Debian packages only

- Added --debian-only flag that skips Python/C building and SSL/logo generation
- Only performs Debian package building and dependency checking
- Useful for quick package rebuilds after Debian packaging changes
- Maintains all existing functionality when used with --debian
- Provides focused output showing only Debian package results
parent 751d6c8a
...@@ -2,15 +2,21 @@ ...@@ -2,15 +2,21 @@
# Parse command line arguments # Parse command line arguments
BUILD_DEBIAN=false BUILD_DEBIAN=false
BUILD_DEBIAN_ONLY=false
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--debian) --debian)
BUILD_DEBIAN=true BUILD_DEBIAN=true
shift shift
;; ;;
--debian-only)
BUILD_DEBIAN_ONLY=true
BUILD_DEBIAN=true
shift
;;
*) *)
echo "Unknown option: $1" echo "Unknown option: $1"
echo "Usage: $0 [--debian]" echo "Usage: $0 [--debian] [--debian-only]"
exit 1 exit 1
;; ;;
esac esac
...@@ -35,14 +41,16 @@ pip3 install pyinstaller ...@@ -35,14 +41,16 @@ pip3 install pyinstaller
# Create dist directory if not exists # Create dist directory if not exists
mkdir -p dist mkdir -p dist
# Generate SSL certificates if they don't exist # Skip Python/C building if --debian-only is specified
if [ ! -f "cert.pem" ] || [ ! -f "key.pem" ]; then if [ "$BUILD_DEBIAN_ONLY" = false ]; then
# Generate SSL certificates if they don't exist
if [ ! -f "cert.pem" ] || [ ! -f "key.pem" ]; then
echo "Generating SSL certificates..." echo "Generating SSL certificates..."
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost" openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"
fi fi
# Generate logos and icons from image.jpg if it exists # Generate logos and icons from image.jpg if it exists
if [ -f "image.jpg" ] && command -v convert &> /dev/null; then if [ -f "image.jpg" ] && command -v convert &> /dev/null; then
echo "Generating logos and icons..." echo "Generating logos and icons..."
mkdir -p logos mkdir -p logos
...@@ -63,25 +71,25 @@ if [ -f "image.jpg" ] && command -v convert &> /dev/null; then ...@@ -63,25 +71,25 @@ if [ -f "image.jpg" ] && command -v convert &> /dev/null; then
convert image.jpg -resize 32x32 logos/favicon.ico convert image.jpg -resize 32x32 logos/favicon.ico
echo "Logo generation complete." echo "Logo generation complete."
fi fi
# Build Python binaries # Build Python binaries
echo "Building Python binaries..." echo "Building Python binaries..."
# Build wssshd (server) binary with certificates and web assets # Build wssshd (server) binary with certificates and web assets
pyinstaller --onefile --distpath dist --add-data "cert.pem:." --add-data "key.pem:." --add-data "templates:templates" --add-data "static:static" --runtime-tmpdir /tmp --clean wssshd.py pyinstaller --onefile --distpath dist --add-data "cert.pem:." --add-data "key.pem:." --add-data "templates:templates" --add-data "static:static" --runtime-tmpdir /tmp --clean wssshd.py
# Build wssshc (client) binary # Build wssshc (client) binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wssshc.py pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wssshc.py
# Build wsssh binary # Build wsssh binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsssh.py pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsssh.py
# Build wsscp binary # Build wsscp binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsscp.py pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsscp.py
# Build C version if wssshtools directory exists # Build C version if wssshtools directory exists
if [ -d "wssshtools" ]; then if [ -d "wssshtools" ]; then
echo "Building C version..." echo "Building C version..."
cd wssshtools cd wssshtools
if [ -f "configure.sh" ]; then if [ -f "configure.sh" ]; then
...@@ -92,6 +100,7 @@ if [ -d "wssshtools" ]; then ...@@ -92,6 +100,7 @@ if [ -d "wssshtools" ]; then
echo "Warning: configure.sh not found in wssshtools/" echo "Warning: configure.sh not found in wssshtools/"
cd .. cd ..
fi fi
fi
fi fi
# Build Debian package if requested # Build Debian package if requested
...@@ -130,18 +139,26 @@ fi ...@@ -130,18 +139,26 @@ fi
# Deactivate venv # Deactivate venv
deactivate deactivate
echo "Build complete. Binaries are in dist/ directory:" if [ "$BUILD_DEBIAN_ONLY" = true ]; then
echo "- dist/wssshd (server with web interface)" echo "Debian package build complete."
echo "- dist/wssshc (client)" if ls dist/wsssh-tools*.deb >/dev/null 2>&1; then
echo "- dist/wsssh (SSH wrapper)" echo "Package available in dist/ directory:"
echo "- dist/wsscp (SCP wrapper)" echo "- dist/wsssh-tools*.deb (Debian package)"
fi
if [ -d "wssshtools" ] && [ -f "wssshtools/wssshc" ]; then else
echo "Build complete. Binaries are in dist/ directory:"
echo "- dist/wssshd (server with web interface)"
echo "- dist/wssshc (client)"
echo "- dist/wsssh (SSH wrapper)"
echo "- dist/wsscp (SCP wrapper)"
if [ -d "wssshtools" ] && [ -f "wssshtools/wssshc" ]; then
echo "- wssshtools/wssshc (C client)" echo "- wssshtools/wssshc (C client)"
echo "- wssshtools/wsssh (C SSH wrapper)" echo "- wssshtools/wsssh (C SSH wrapper)"
echo "- wssshtools/wsscp (C SCP wrapper)" echo "- wssshtools/wsscp (C SCP wrapper)"
fi fi
if [ "$BUILD_DEBIAN" = true ] && ls dist/wsssh-tools*.deb >/dev/null 2>&1; then if [ "$BUILD_DEBIAN" = true ] && ls dist/wsssh-tools*.deb >/dev/null 2>&1; then
echo "- dist/wsssh-tools*.deb (Debian package)" echo "- dist/wsssh-tools*.deb (Debian package)"
fi
fi fi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment