2023-07-15 Backup WSL to Mega Tags: wsl mega## Install Mega cmd Add the Mega repository in wsl sources, create `/etc/apt/sources.list.d/megasync.list`: ``` deb [signed-by=/usr/share/keyrings/meganz-archive-keyring.gpg] https://mega.nz/linux/repo/xUbuntu_22.04/ ./ ``` Import key and install: ``` curl -s "https://mega.nz/linux/repo/xUbuntu_22.04/Release.key" | gpg --dearmor | sudo tee /usr/share/keyrings/mega-nz.gpg sudo apt update sudo apt install megacmd ``` Create unlocker binary in `/usr/local/bin/mega-unlock`: ``` #!/usr/bin/bash read -s pass mega-login <username> $pass unset pass ``` Run it and enter the Mega password: ``` chmod +x /usr/local/bin/mega-unlock mega-unlock ``` ## Setup backup Prepare backup directories and set up sync: ``` mega-mkdir wsl mkdir sync mega-sync sync wsl ``` Create backup script `backup.sh`: ``` #!/usr/bin/bash zip -r -9 sync/backup.zip . -x "/.*" -x "/sync/*" ``` ## Remove Mega autocompletion This seems to be a bug in WSL, seems to slow down startup of each instance. Remove `/etc/bash_completion.d/megacmd_completion.sh` to fix.