rebuild and optimize binary

This commit is contained in:
Othman Hendy Suseno
2025-09-09 23:33:17 +07:00
parent 3bc20eab78
commit 1dbb508643
2 changed files with 121 additions and 0 deletions

121
DISTRIBUTION.md Normal file
View File

@@ -0,0 +1,121 @@
# Distribution Guide
## Single Binary Distribution
Ya, untuk distribusi cukup share file `drive-migrator.exe` saja! Binary Go sudah self-contained.
### Build untuk Distribusi
```bash
# Build optimized (ukuran lebih kecil)
go build -ldflags="-s -w" -buildvcs=false
# Hasil: drive-migrator.exe (~7.4 MB)
```
### Requirements untuk End User
**Yang WAJIB ada di mesin target:**
1. **rclone** - Download dari https://rclone.org/downloads/
```bash
# Windows (PowerShell as Admin)
winget install Rclone.Rclone
# Atau manual download dan add ke PATH
```
**Yang TIDAK perlu:**
- Go compiler
- Source code
- Dependencies lain
### Cara Distribusi
#### Option 1: Direct Binary
```
📁 drive-migrator-v1.0/
├── drive-migrator.exe
├── README.md
└── examples/
├── nextcloud-to-gdrive.bat
└── gdrive-to-onedrive.bat
```
#### Option 2: Installer Package
Buat installer sederhana yang:
1. Copy `drive-migrator.exe` ke `C:\Program Files\drive-migrator\`
2. Add ke PATH
3. Check apakah rclone sudah terinstall
4. Buat shortcut di Start Menu
#### Option 3: Portable ZIP
```
📁 drive-migrator-portable.zip
├── drive-migrator.exe
├── README.md
├── examples/
└── install-rclone.bat # Script untuk install rclone otomatis
```
### Cross-Platform Build
Untuk distribusi multi-platform:
```bash
# Windows 64-bit
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -buildvcs=false -o dist/windows/drive-migrator.exe
# Linux 64-bit
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -buildvcs=false -o dist/linux/drive-migrator
# macOS 64-bit
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -buildvcs=false -o dist/macos/drive-migrator
# macOS ARM (M1/M2)
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -buildvcs=false -o dist/macos-arm/drive-migrator
```
### Example Batch Files untuk User
**nextcloud-to-gdrive.bat:**
```batch
@echo off
echo Starting Nextcloud to Google Drive migration...
drive-migrator.exe migrate ^
--source-name nextcloud_source ^
--source-type nextcloud ^
--source-url "https://your-nextcloud.com/remote.php/dav/files/username" ^
--source-user "username" ^
--source-pass "password" ^
--dest-name gdrive_dest ^
--dest-type gdrive ^
--dest-sa-file "service-account.json" ^
--log-file migration.log ^
--include "Documents/**"
pause
```
### Checklist Distribusi
- ✅ Binary sudah optimized (`-ldflags="-s -w"`)
- ✅ README dengan contoh penggunaan
- ✅ Example scripts/batch files
- ✅ Instruksi install rclone
- ✅ Troubleshooting guide
- ⚠️ Test di mesin bersih (tanpa Go/development tools)
### Tips untuk End User
1. **Letakkan di folder khusus:**
```
C:\Tools\drive-migrator\
├── drive-migrator.exe
├── configs/
└── logs/
```
2. **Add ke PATH** agar bisa dipanggil dari mana saja
3. **Buat config file** di `%USERPROFILE%\.drive-migrator.yaml`
Jadi ya, cukup share `drive-migrator.exe` + dokumentasi + pastikan user install rclone!

Binary file not shown.