Created
July 30, 2024 06:39
-
-
Save snacsnoc/750dab879780584a95bee271bbbe4608 to your computer and use it in GitHub Desktop.
Backup all AlphaSmart Neo (2) applets with neotools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Fetch the list of applets and save the JSON output to a temporary file | |
| sudo neotools applets list > applets.json | |
| sleep 10 | |
| jq -c '.[]' applets.json | while read -r applet; do | |
| applet_id=$(echo "$applet" | jq '.applet_id') | |
| # sanitize name for filename | |
| applet_name=$(echo "$applet" | jq -r '.name' | sed 's/[^A-Za-z0-9_]/-/g') | |
| # Skip the system applet (applet_id = 0) | |
| if [ "$applet_id" -eq 0 ]; then | |
| echo "Skipping system applet..." | |
| continue | |
| fi | |
| # Use the extracted applet ID to fetch the applet using neotools | |
| output_filename="${applet_name}-${applet_id}.OS3KApp" | |
| echo "Fetching applet ID $applet_id as $output_filename" | |
| sudo neotools applets fetch "$applet_id" "$output_filename" | |
| echo "Waiting for the USB connection to stabilize..." | |
| # This value is completely arbitrary | |
| sleep 16 | |
| done | |
| rm applets.json | |
| echo "All non-system applets have been successfully fetched." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment