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 @@
# Parse command line arguments
BUILD_DEBIAN=false
BUILD_DEBIAN_ONLY=false
while [[ $# -gt 0 ]]; do
case $1 in
--debian)
BUILD_DEBIAN=true
shift
;;
--debian-only)
BUILD_DEBIAN_ONLY=true
BUILD_DEBIAN=true
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--debian]"
echo "Usage: $0 [--debian] [--debian-only]"
exit 1
;;
esac
......@@ -35,62 +41,65 @@ pip3 install pyinstaller
# Create dist directory if not exists
mkdir -p dist
# Generate SSL certificates if they don't exist
if [ ! -f "cert.pem" ] || [ ! -f "key.pem" ]; then
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"
fi
# Skip Python/C building if --debian-only is specified
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..."
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
# Generate logos and icons from image.jpg if it exists
if [ -f "image.jpg" ] && command -v convert &> /dev/null; then
echo "Generating logos and icons..."
mkdir -p logos
# Generate logos and icons from image.jpg if it exists
if [ -f "image.jpg" ] && command -v convert &> /dev/null; then
echo "Generating logos and icons..."
mkdir -p logos
# Generate various logo sizes
convert image.jpg -resize 512x512 logos/logo-512.png
convert image.jpg -resize 256x256 logos/logo-256.png
convert image.jpg -resize 128x128 logos/logo-128.png
convert image.jpg -resize 64x64 logos/logo-64.png
# Generate various logo sizes
convert image.jpg -resize 512x512 logos/logo-512.png
convert image.jpg -resize 256x256 logos/logo-256.png
convert image.jpg -resize 128x128 logos/logo-128.png
convert image.jpg -resize 64x64 logos/logo-64.png
# Generate icon sizes
for size in 16 32 48 64 128 256; do
convert image.jpg -resize ${size}x${size} logos/icon-${size}.png
done
# Generate icon sizes
for size in 16 32 48 64 128 256; do
convert image.jpg -resize ${size}x${size} logos/icon-${size}.png
done
# Generate additional assets
convert image.jpg -resize 800x200 logos/banner-800x200.png
convert image.jpg -quality 100 logos/logo-high-quality.png
convert image.jpg -resize 32x32 logos/favicon.ico
# Generate additional assets
convert image.jpg -resize 800x200 logos/banner-800x200.png
convert image.jpg -quality 100 logos/logo-high-quality.png
convert image.jpg -resize 32x32 logos/favicon.ico
echo "Logo generation complete."
fi
echo "Logo generation complete."
fi
# Build Python binaries
echo "Building Python binaries..."
# Build Python binaries
echo "Building Python binaries..."
# 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
# 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
# Build wssshc (client) binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wssshc.py
# Build wssshc (client) binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wssshc.py
# Build wsssh binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsssh.py
# Build wsssh binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsssh.py
# Build wsscp binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsscp.py
# Build wsscp binary
pyinstaller --onefile --distpath dist --runtime-tmpdir /tmp --clean wsscp.py
# Build C version if wssshtools directory exists
if [ -d "wssshtools" ]; then
echo "Building C version..."
cd wssshtools
if [ -f "configure.sh" ]; then
./configure.sh
make
cd ..
else
echo "Warning: configure.sh not found in wssshtools/"
cd ..
# Build C version if wssshtools directory exists
if [ -d "wssshtools" ]; then
echo "Building C version..."
cd wssshtools
if [ -f "configure.sh" ]; then
./configure.sh
make
cd ..
else
echo "Warning: configure.sh not found in wssshtools/"
cd ..
fi
fi
fi
......@@ -130,18 +139,26 @@ fi
# Deactivate venv
deactivate
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/wsssh (C SSH wrapper)"
echo "- wssshtools/wsscp (C SCP wrapper)"
fi
if [ "$BUILD_DEBIAN_ONLY" = true ]; then
echo "Debian package build complete."
if ls dist/wsssh-tools*.deb >/dev/null 2>&1; then
echo "Package available in dist/ directory:"
echo "- dist/wsssh-tools*.deb (Debian package)"
fi
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/wsssh (C SSH wrapper)"
echo "- wssshtools/wsscp (C SCP wrapper)"
fi
if [ "$BUILD_DEBIAN" = true ] && ls dist/wsssh-tools*.deb >/dev/null 2>&1; then
echo "- dist/wsssh-tools*.deb (Debian package)"
if [ "$BUILD_DEBIAN" = true ] && ls dist/wsssh-tools*.deb >/dev/null 2>&1; then
echo "- dist/wsssh-tools*.deb (Debian package)"
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