Skip to content

Commit

Permalink
24.09 Update
Browse files Browse the repository at this point in the history
- Version bump (24.09)
- Added "packagelist" file check before checking for custom launcher
- Improved readability and consistency of scripts by replacing $args[1]/$1 with variable names with meaning $app/option throughout all scripts
- Debloat script now requires an option to run instead of automatically debloating
- Simplified/sped up PowerShell debloat script by formatting Debloat.txt instead of every string it outputs into the array
- Formatting fixes
- Created install script for all platforms that installs dependencies and adds Fire Tools to start/app menu
- Updated Gapps README links
- Added note about no affiliation with [Datastream33's Amazon Fire Toolbox](https://xdaforums.com/t/windows-linux-tool-fire-toolbox-v36-1.3889604/) to README
- Updated scripts README with info about install script
- Updated screenshot
  • Loading branch information
mrhaydendp authored Sep 16, 2024
2 parents 9650fe5 + 4cab2dc commit 5b8af68
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 69 deletions.
15 changes: 8 additions & 7 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Updated main.py, requirements.txt, version, appinstaller.sh, appinstaller.ps1 08/21/2024
- Version bump (24.08)
- Added Fire TV Channels (com.amazon.hedwig) to debloat list
- Added space between changelog and "Updating: module" text during update process
- Updated Packaging and Requests version in requirements.txt
- Fixed update tool endlessly having updates available
- LauncherHijack will now only be installed if you don't have it
## Updated: appinstaller, debloat, install, main, version | Date: 09/15/2024
- Version bump (24.09)
- Added "packagelist" file check before checking for custom launcher to reduce errors
- Improved readability and consistency of scripts by replacing $args[1]/$1 variables with $app/option throughout all scripts
- Debloat script now requires an option to run instead of automatically debloating
- Simplified/sped up PowerShell debloat script by formatting Debloat.txt instead of every string it outputs into the array (to match Linux/macOS)
- Formatting fixes
- Created install script for all platforms that installs dependencies and adds Fire Tools to start/app menu
4 changes: 2 additions & 2 deletions Fire-Tools/Gapps/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Terms
Fire-Tools does not provide you with any license for Google’s APKs included in the releases. Packages are included to provide a convenient way to sideload APKs to your device. Included apps are as follows:
- [Google Play Store 40.6.28-23.apkm](https://www.apkmirror.com/apk/google-inc/google-play-store/google-play-store-40-6-28-release/google-play-store-40-6-28-23-0-pr-625422852-4-android-apk-download/)
- [Google Play Services 24.13.19.apkm](https://www.apkmirror.com/apk/google-inc/google-play-services/google-play-services-24-13-19-release/google-play-services-24-13-19-040400-626168189-android-apk-download/)
- [Google Play Store 42.6.23-23.apkm](https://www.apkmirror.com/apk/google-inc/google-play-store/google-play-store-42-6-23-release/google-play-store-42-6-23-23-0-pr-670678617-2-android-apk-download/)
- [Google Play Services 24.35.30.apkm](https://www.apkmirror.com/apk/google-inc/google-play-services/google-play-services-24-35-30-release/google-play-services-24-35-30-040400-668017056-2-android-apk-download/)
- [Google Services Framework 9-6957767.apk](https://www.apkmirror.com/apk/google-inc/google-services-framework/google-services-framework-9-6957767-release/google-services-framework-9-6957767-android-apk-download/)
- [Google Services Framework 10-6494331.apk](https://www.apkmirror.com/apk/google-inc/google-services-framework/google-services-framework-10-6494331-release/google-services-framework-10-6494331-android-apk-download/)
20 changes: 12 additions & 8 deletions Fire-Tools/Scripts/Posix/appinstaller.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#!/usr/bin/env sh

# Export Package List to Compare After Installation
# Set Variables & Export Package List
app="$1"
option="$2"
adb shell pm list packages -3 > packagelist

# Change Application Installation Method Based on Filetype
printf "%s\n" "Installing: $1"
case "$1" in
printf "%s\n" "Installing: $app"
case "$app" in
*.apk)
adb install -g "$1" >/dev/null 2>&1;;
adb install -g "$app" >/dev/null 2>&1;;
*.apkm)
unzip "$1" -d ./Split >/dev/null
unzip "$app" -d ./Split >/dev/null
adb install-multiple -r -g ./Split/*.apk >/dev/null 2>&1
rm -rf ./Split;;
esac
[ "$?" = 0 ] && printf "%s\n\n" "Success" || printf "%s\n\n" "Fail"

# Grant Launcher Appwidget Permission & Attempt to Disable Fire Launcher. If Failed, Install LauncherHijack
if [ "$2" = "Launcher" ]; then
if [ "$option" = "Launcher" ]; then
adb shell pm list packages -3 > packagelist.new
launcher=$(diff packagelist* | grep -E -o "[a-z0-9]*(\.[a-z0-9]+)+[a-z0-9]")
[ -n "$launcher" ] && adb shell appwidget grantbind --package "$launcher"
if [ -s packagelist ]; then
launcher=$(diff packagelist* | grep -E -o "[a-z0-9]*(\.[a-z0-9]+)+[a-z0-9]")
[ -n "$launcher" ] && adb shell appwidget grantbind --package "$launcher"
fi
adb shell pm disable-user -k com.amazon.firelauncher >/dev/null 2>&1 ||
grep -q "com.baronkiko.launcherhijack" ./packagelist || ./Scripts/Posix/appinstaller.sh LauncherHijackV403.apk
fi
40 changes: 21 additions & 19 deletions Fire-Tools/Scripts/Posix/debloat.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
#!/usr/bin/env sh

# Set Variables & Export Package List
option="$1"
app="$2"
packages=$(awk '{print $1}' < Debloat.txt)
adb shell pm list packages -s > packagelist

# Change ADB Shell Arguments Based on Selection
debloat () {
case "$1" in
Enable)
adb shell pm enable "$2" >/dev/null 2>&1;;
Disable)
adb shell pm disable-user "$2" >/dev/null 2>&1 && adb shell pm clear "$2" > /dev/null;;
esac
# [Enable/Disable]d: package || Failed to [Enable/Disable]: Package
[ "$?" = 0 ] && printf "%sd: $2\n" "$1" || printf "%s\n" "Failed to $1: $2"
case "$option" in
Enable)
adb shell pm enable "$app" >/dev/null 2>&1;;
Disable)
adb shell pm disable-user "$app" >/dev/null 2>&1 && adb shell pm clear "$app" > /dev/null;;
esac
# Enable/Disable(d): package || Failed to Enable/Disable: package
[ "$?" = 0 ] && printf "%sd: $app\n" "$option" || printf "%s\n" "Failed to $option: $app"
}

# If a Package is Specified, Only run Debloat Function
if [ -n "$2" ]; then
debloat "$1" "$2"
else
# Save Debloat.txt to a Variable & Export Package List
packages=$(awk '{print $1}' < Debloat.txt)
adb shell pm list packages -s > packagelist

if [ -n "$app" ]; then
debloat "$option" "$app"
elif [ -n "$option" ]; then
# Loop & Check if Package from Debloat.txt is Present in 'packagelist' if so, Send to the Debloat Function with Enable/Disable Option
for package in ${packages}; do
grep -q "$package" < packagelist && debloat "$1" "$package"
for app in ${packages}; do
grep -q "$package" < packagelist && debloat "$option" "$app"
done
if [ "$1" = "Enable" ]; then
if [ "$option" = "Enable" ]; then
printf "%s\n" "Enabling Location"
adb shell settings put secure location_providers_allowed network
printf "%s\n" "Disabling Private DNS"
Expand All @@ -35,7 +37,7 @@ else
debloat Enable "com.amazon.$package"
done
printf "%s\n\n" "Successfully Enabled Fire OS Bloat"
else
elif [ "$option" = "Disable" ]; then
printf "%s\n" "Disabling Telemetry & Resetting Advertising ID"
adb shell settings put secure limit_ad_tracking 1
adb shell settings put secure usage_metrics_marketing_enabled 0
Expand Down
42 changes: 42 additions & 0 deletions Fire-Tools/Scripts/Posix/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env sh

# Install Brew Without Interaction
install_brew() {
yes | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo "eval \"\$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)\"") >> "$HOME/.bashrc"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
}

# Download & Unzip Fire Tools
curl -LO https://github.com/mrhaydendp/fire-tools/releases/latest/download/Fire-Tools.zip
unzip -o Fire-Tools.zip -d "$HOME"
rm Fire-Tools.zip

# Install Dependencies with Respective Package Manager
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID_LIKE" in
*debian*)
sudo apt install -y adb python3 python3-tk python3-pip;;
*arch*)
sudo pacman -S --noconfirm android-tools tk python-pip;;
*fedora*)
sudo dnf install -y android-tools python3-tkinter python3-pip;;
*)
echo "Unknown/Unsupported OS"
exit 1;;
esac
else
command -v brew >/dev/null 2>&1 || install_brew
yes | brew install android-platform-tools python-tk
fi

# Download Latest Requirements File & Install with Pip
curl -L "https://raw.githubusercontent.com/mrhaydendp/Fire-Tools/main/Fire-Tools/requirements.txt" -o "$HOME/Fire-Tools/requirements.txt"
pip install -r "$HOME/Fire-Tools/requirements.txt"

# Create .Desktop File
if [ -d "$HOME/.local/share/applications" ]; then
printf "[Desktop Entry]\nName=Fire Tools\nExec=python3 %s/Fire-Tools/main.py\nTerminal=true\nType=Application\nCategories=Utility" "$HOME" > "$HOME/.local/share/applications/Fire-Tools.desktop"
chmod +x "$HOME/.local/share/applications/Fire-Tools.desktop"
fi
6 changes: 4 additions & 2 deletions Fire-Tools/Scripts/PowerShell/appinstaller.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ if ("$?" -eq "True"){Write-Host "Success`n"} else {Write-Host "Fail`n"}

# Grant Launcher Appwidget Permission & Attempt to Disable Fire Launcher. If Failed, Install LauncherHijack
if ("$option" -eq "Launcher"){
(Compare-Object (Get-Content .\packagelist) (adb shell pm list packages -3)).InputObject | Select -First 1 | % {
adb shell appwidget grantbind --package "$_".split(":")[1]
if (Get-Content .\packagelist){
(Compare-Object (Get-Content .\packagelist) (adb shell pm list packages -3)).InputObject | Select -First 1 | % {
adb shell appwidget grantbind --package "$_".split(":")[1]
}
}
adb shell pm disable-user -k com.amazon.firelauncher *> $null
if ("$?" -eq "False") {
Expand Down
46 changes: 22 additions & 24 deletions Fire-Tools/Scripts/PowerShell/debloat.ps1
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
# Set Variables & Export Package List
$option = $args[0]
$app = $args[1]
$packages = Get-Content .\Debloat.txt | % { $_.Split(" #")[0] }
adb shell pm list packages | Out-File packagelist

# Enable or Disable Specified Package and Provide Clean Output
function debloat {
if ($args[0] -eq "Disable"){
adb shell pm disable-user $args[1] *> $null
if ("$?" -eq "True") {adb shell pm clear $args[1] *> $null}
} elseif ($args[0] -eq "Enable"){
adb shell pm enable $args[1] *> $null
}
if ("$?" -eq "True"){
Write-Host "$($args[0])d: $($args[1])"
} else {
Write-Host "Failed to $($args[0]): $($args[1])"
if ("$option" -eq "Disable"){
adb shell pm disable-user "$app" *> $null
if ("$?" -eq "True") {adb shell pm clear "$app" *> $null}
} elseif ("$option" -eq "Enable"){
adb shell pm enable "$app" *> $null
}
if ("$?" -eq "True"){Write-Host "$($option)d: $($app)"} else {Write-Host "Failed to $($option): $($app)"}
}

# If a Package is Specified, Only run Debloat Function
if ($args[1]){
debloat $args[0] $args[1]
} else {
# Save Debloat.txt to a Variable & Export Package List
$disable = Get-Content .\Debloat.txt
adb shell pm list packages | Out-File packagelist

if ("$app"){
debloat "$option" "$app"
} elseif ("$option") {
# Loop & Check if Package from Debloat.txt is Present in 'packagelist' if so, Send to the Debloat Function with Enable/Disable Option
foreach ($package in $disable){
if (Select-String $package.split(' #')[0] .\packagelist){
debloat $args[0] $package.split(" #")[0]
foreach ($app in $packages){
if (Select-String "$app" .\packagelist){
debloat "$option" "$app"
}
}
if ($args[0] -eq "Enable"){
if ("$option" -eq "Enable"){
Write-Host "Disabling Private DNS"
adb shell settings put global private_dns_mode off
Write-Host "Enabling Location Services"
adb shell settings put global location_global_kill_switch 0
Write-Host "Enabling Core Apps"
$core = @("firelauncher", "device.software.ota", "device.software.ota.override", "kindle.otter.oobe.forced.ota")
foreach ($package in $core){
debloat Enable com.amazon."$package"
foreach ($app in $core){
debloat Enable "com.amazon.$app"
}
Write-Host "Enabling Background Activities"
adb shell settings put global always_finish_activities 0
Write-Host "Successfully Enabled Fire OS Bloat`n"
} else {
} elseif ("$option" -eq "Disable") {
Write-Host "Disabling Telemetry & Resetting Advertising ID"
adb shell settings put secure limit_ad_tracking 1
adb shell settings put secure usage_metrics_marketing_enabled 0
Expand Down
37 changes: 37 additions & 0 deletions Fire-Tools/Scripts/PowerShell/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Download, Extract to AppData\Roaming, then Delete Fire-Tools.zip
Start-BitsTransfer -Source "https://github.com/mrhaydendp/fire-tools/releases/latest/download/Fire-Tools.zip"
Expand-Archive -Path .\Fire-Tools.zip -Destination "$env:APPDATA" -Force
Remove-Item -Path .\Fire-Tools.zip

# Add Shortcut to Start Menu
$WshShell = New-Object -COMObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Fire Tools.lnk")
$Shortcut.TargetPath = "$env:APPDATA\Fire-Tools\main.py"
$Shortcut.WorkingDirectory = "$env:APPDATA\Fire-Tools"
$Shortcut.Save()

# Check / Install Python & Requirements
if (!(Select-String -Pattern "Python" -InputObject "$env:PATH" -Quiet)) {
if (Get-Command winget) {
winget install -s winget "Python.Python.3.12" --force
} else {
# Find Latest Python Version by Scraping Page & Install
$latest = (Invoke-WebRequest -Uri "https://www.python.org/downloads/").Links.href -like "*.exe"
Start-BitsTransfer -Source "$latest" -Destination .\python-latest.exe
.\python-latest.exe /passive PrependPath=1
while (!(Get-Package -Name "*Python*" -ErrorAction SilentlyContinue)) {}
Remove-Item -Path .\python-latest.exe
}
Start-BitsTransfer -Source "https://raw.githubusercontent.com/mrhaydendp/Fire-Tools/main/Fire-Tools/requirements.txt" -Destination "$env:APPDATA\Fire-Tools"
pip install -r "$env:APPDATA\Fire-Tools\requirements.txt"
}

# Check / Install ADB (Download, Extract, Backup & Set Environment Variable)
if (!(Select-String -Pattern "platform-tools" -InputObject "$env:PATH" -Quiet)) {
Start-BitsTransfer -Source "https://dl.google.com/android/repository/platform-tools-latest-windows.zip"
Expand-Archive -Path .\platform-tools-latest-windows.zip -Destination "$HOME" -Force
Remove-Item -Path .\platform-tools-latest-windows.zip
[Environment]::SetEnvironmentVariable("PATH_BACKUP","$env:PATH","User")
Set-Item -Path Env:\PATH -Value ("$env:PATH;$HOME\platform-tools")
[Environment]::SetEnvironmentVariable("Path","$env:PATH","User")
}
5 changes: 3 additions & 2 deletions Fire-Tools/Scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Scripts
Backend scripts that make the tool function:
- Debloat: Handles debloat/undo function & accepts input to disable/enable selected packages.
- Debloat: Handles debloat/undo functions & accepts input to disable/enable selected packages.
- AppInstaller: Handles app installations of multiple file types (.apk/.apkm) & sets launcher specific options.
- Identify: Identifies device name by using model number & Amazon developer page.
- Identify: Identifies device name by using model number & matching with [Amazon developer page](https://developer.amazon.com/docs/fire-tablets/ft-identifying-tablet-devices.html).
- Install: Downloads and sets up required dependencies for Fire Tools & adds it to start/app menu
3 changes: 1 addition & 2 deletions Fire-Tools/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
os.chdir(os.path.dirname(os.path.realpath(__file__)))

# Platform & Device Variables
version = "24.08"
version = "24.09"
platform = "Linux/macOS"
path = f"{os.getcwd()}/Scripts/Posix/"

extension = ".sh"
shell = "Posix"
if os.name == "nt":
Expand Down
2 changes: 1 addition & 1 deletion Fire-Tools/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.08
24.09
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ python main.py

**Important Notes:**

* Although this project has similar goals, it is not affiliated with [Datastream33's Amazon Fire Toolbox](https://xdaforums.com/t/windows-linux-tool-fire-toolbox-v36-1.3889604/)
* Some features of the Fire Tools may break due to Fire OS updates but I'll try my best to keep them working.
* Set timezone settings before debloat! (re-enable `com.amazon.kindle.otter.oobe` to change date & time settings)
* Google Apps are downloaded from [ApkMirror](https://www.apkmirror.com/) and are included in releases for convienence see [terms](https://github.com/mrhaydendp/Fire-Tools/blob/main/Fire-Tools/Gapps/README.md).
* Google Apps are downloaded from [ApkMirror](https://www.apkmirror.com/) and are included in releases for convienence see [terms](https://github.com/mrhaydendp/Fire-Tools/blob/main/Fire-Tools/Gapps/README.md). APK names and corresponding URLs can be found in Fire-Tools/Gapps/README.md
* Debloat will disable most amazon apps with the exception of: `Calculator`, `Camera`, `Clock`, `Files`, `Fire Launcher`, `Silk Browser`, and `Settings`
* Warranty and Reset: Using Fire Tools doesn't void your warranty and all changes can be reversed with a factory reset.
* Disclaimer: While I developed this tool, I am not responsible for any issues arising from its use.

**Credits:** Fire Tools thanks and acknowledges the following projects. They are included for your convenience:

* [Google](https://www.android.com/) (GApps)
Expand Down
Binary file modified Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5b8af68

Please sign in to comment.