rename to client
This commit is contained in:
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Upload NDK bundle files to server
|
||||
# Usage: ./upload_bundle.sh
|
||||
|
||||
SERVER="ubuntu@laantungir.net"
|
||||
FINAL_PATH="/var/www/html/ndk"
|
||||
FILES=("build/ndk-core.bundle.js" "build/ndk-core.bundle.js.map")
|
||||
|
||||
echo "📦 Uploading NDK bundle to server..."
|
||||
echo ""
|
||||
|
||||
# Check if files exist
|
||||
for file in "${FILES[@]}"; do
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "❌ Error: $file not found. Run 'node build-ndk-bundle.js' first."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Upload files to ubuntu home directory
|
||||
for file in "${FILES[@]}"; do
|
||||
filename=$(basename "$file")
|
||||
size=$(du -h "$file" | cut -f1)
|
||||
|
||||
echo ""
|
||||
echo "📤 Uploading $filename ($size)..."
|
||||
scp "$file" "$SERVER:~/$filename"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ $filename uploaded to home directory"
|
||||
else
|
||||
echo "❌ Failed to upload $filename"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Move files to final location with sudo and set www-data ownership
|
||||
echo ""
|
||||
echo "📁 Moving files to $FINAL_PATH and setting permissions..."
|
||||
ssh $SERVER "sudo mkdir -p $FINAL_PATH && sudo mv ~/*.js ~/*.map $FINAL_PATH/ 2>/dev/null; sudo chown www-data:www-data $FINAL_PATH/*.js $FINAL_PATH/*.map && sudo chmod 644 $FINAL_PATH/*.js $FINAL_PATH/*.map"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Files moved to final location with www-data ownership"
|
||||
else
|
||||
echo "❌ Failed to move files to final location"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✅ All files uploaded successfully!"
|
||||
echo ""
|
||||
echo "🌐 Bundle available at:"
|
||||
echo " https://laantungir.net/ndk/ndk-core.bundle.js"
|
||||
echo " https://laantungir.net/ndk/ndk-core.bundle.js.map"
|
||||
echo ""
|
||||
echo "📋 Test with: test-ndk.html"
|
||||
Reference in New Issue
Block a user