43 Commits
Author SHA1 Message Date
josephsmendoza c392631339 fix "failed to load curl" 2019-10-11 02:14:14 -07:00
josephsmendoza c5de32f6dd fix windows search path 2019-10-11 02:04:59 -07:00
josephsmendoza 2df8f900d6 fixed installer issues 2019-10-11 01:00:25 -07:00
josephsmendoza 73abfb8fa8 GUI done, abi needs fix before release 2019-10-10 15:33:35 -07:00
Joseph mendozaandGitHub a62f1e998f Delete build.sh 2019-09-23 23:58:59 -07:00
Joseph mendozaandGitHub 7821de4bb4 Delete build.ps1 2019-09-23 23:58:50 -07:00
Joseph Mendoza 97a89f4382 basic gui alost done 2 2019-09-23 23:58:09 -07:00
Joseph Mendoza 7aab701aa1 basic gui almost done 2019-09-23 23:57:09 -07:00
josephsmendoza b8686d4a04 proper dub project structure 2019-09-11 05:40:28 -07:00
Joseph mendozaandGitHub 2be4c47213 Update README.md 2019-09-10 19:26:44 -07:00
Joseph mendozaandGitHub d5582d17e3 Delete gui.d 2019-09-10 19:18:10 -07:00
Joseph mendozaandGitHub ba1ba3937d Delete cli.d 2019-09-10 19:17:55 -07:00
Joseph mendozaandGitHub fef18f8b68 Delete build.sh 2019-09-10 19:17:45 -07:00
Joseph mendozaandGitHub d137448a7b Delete build.cmd 2019-09-10 19:17:34 -07:00
Joseph mendozaandGitHub 4ce50aa635 Delete adbi.d 2019-09-10 19:17:23 -07:00
Joseph mendozaandGitHub ed5f4d7813 Delete adbi.cmd 2019-09-10 19:17:07 -07:00
josephsmendoza 433330f743 Merge branch 'master' of https://github.com/josephsmendoza/ADB-Installer 2019-09-10 19:08:33 -07:00
josephsmendoza e7f00bdff7 pre-gui work 2019-09-10 19:07:57 -07:00
Joseph mendozaandGitHub 550e52cf1e Update README.md 2019-08-31 22:24:46 -07:00
Joseph Mendoza 0077844000 mac version working 2019-08-31 21:57:09 -07:00
josephsmendoza c086ad5552 fixed typo 2019-08-15 00:33:59 -07:00
josephsmendoza 0c298432f2 Update adbi.cmd 2019-08-15 00:31:38 -07:00
Joseph mendozaandGitHub 981fea7af8 Create build.sh 2019-08-14 23:17:39 -07:00
Joseph mendozaandGitHub edd7717a08 Update README.md 2019-08-14 23:16:04 -07:00
Joseph mendozaandGitHub 5fc505d789 Merge pull request #2 from josephsmendoza/dlang
Dlang conversion
2019-08-14 15:51:57 -07:00
josephsmendoza fa59eed572 D command line basics done 2019-08-14 15:50:24 -07:00
Josef Mendoza d9e3ca1f50 d conversion start 2019-08-12 01:57:38 -07:00
Josef Mendoza 51c1c71475 d conversion start 2019-08-12 01:57:14 -07:00
Joseph mendozaandGitHub 0e8df6cf77 Update and rename sfx.txt to build.cmd 2019-08-10 12:43:38 -07:00
Joseph mendozaandGitHub b23ded7286 Update README.md 2019-08-10 12:40:16 -07:00
f238391707 Update build.gradle 2019-07-29 03:54:46 -07:00
Joseph mendozaandGitHub 64e8e294c4 Update build.gradle 2019-07-29 03:45:53 -07:00
Joseph mendozaandGitHub dd4ba9f34a Merge pull request #1 from josephsmendoza/java
Java conversion
2019-07-19 17:59:07 -07:00
Joseph mendozaandGitHub 5513cabf3e Update README.md 2019-07-19 17:58:39 -07:00
josephsmendoza cc541e78de java conversion complete 2019-07-19 17:53:20 -07:00
josephsmendoza 2d31e5199f finished windows java portion 2019-07-16 19:47:18 -07:00
josephsmendoza c5fa538b42 added search for adb function 2019-07-12 23:48:57 -07:00
josephsmendoza 32d0f1cde8 Merge branch 'master' of https://github.com/josephsmendoza/ADB-Installer 2019-07-12 13:01:21 -07:00
josephsmendoza 83fc93c670 win 7 compat and big speed boost 2019-07-12 12:59:33 -07:00
Joseph mendozaandGitHub 0925798199 Update README.md 2019-07-10 22:39:41 -07:00
josephsmendoza 2c2501f89b fixed issue when install path doesn't exist 2019-07-05 09:05:48 -07:00
josephsmendoza b18245b13d fixed for new archive format 2019-07-04 15:07:12 -07:00
Joseph Mendoza 317727961e added windefend exclusions 2019-06-17 14:13:19 -07:00
11 changed files with 355 additions and 111 deletions
+3
View File
@@ -0,0 +1,3 @@
bin
res
.dub
+4 -6
View File
@@ -1,14 +1,12 @@
# ADB-Installer
# Android Debug Bridge Installer
Download from [Releases](https://github.com/josephsmendoza/ADB-Installer/releases)
This is a re-implementation of the [15 seconds ADB Installer](https://forum.xda-developers.com/showthread.php?t=2588979)
This installer requires an internet connection.
The main component is [the PowerShell script](https://github.com/josephsmendoza/ADB-Installer/blob/master/install.ps1) which downloads [the latest android platform tools for windows](https://dl.google.com/android/repository/platform-tools-latest-windows.zip) and installs them to either `C:\adb`, an auto-detected previous install location, or a path you can specify via `-installPath`.
For conveinence, this is wrapped in an `.exe` file which runs the script with `ExecutionPolicy` set to `Bypass`. This file is fully automated.
Icon is from [Google via icon-icons.com](https://icon-icons.com/icon/adb/90476)
Built with [7z SFX Builder](https://sourceforge.net/projects/s-zipsfxbuilder)
Windows version packaged with [Ptiso](https://pismotec.com/ptiso/)
Linux & Mac version packaged with [UPX](https://upx.github.io/)
-55
View File
@@ -1,55 +0,0 @@
Param( [Parameter()] [String[]] $installPath )
$adb=$false
$fastboot=$false
if (Get-Command "adb" -ErrorAction SilentlyContinue){
$adb=$true
}
if (Get-Command "fastboot" -ErrorAction SilentlyContinue){
$fastboot=$true
}
if($installPath.Length.Equals(0)){
if(!$adb -and $fastboot){
Write-Output "fastboot installed without adb"
Write-Output "Checking fastboot location via --version ..."
$installPath=fastboot --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
}
if($adb){
Write-Output "adb installed, checking location via --version ..."
$installPath=adb --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
}
if($installPath.Length.Equals(0)){
Write-Output "platform-tools location not found"
$installPath="$HOME\AppData\Roaming\SideQuest\platform-tools\"
}
}
Write-Output "installPath=$installPath"
if(!$adb -and !$fastboot){
Write-Output "Adding $installPath to `$PATH ..."
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$newpath = "$oldpath;$installPath"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
}
Write-Output "Checking Windows Defender Status..."
$defender=cmd /c sc query Windefend
if ( "$defender" -like "*RUNNING*" ){
Write-Output "Defender is running, adding exclusions for adb..."
Add-MpPreference -ExclusionPath $installPath
Add-MpPreference -ExclusionProcess "adb.exe"
} else {
Write-Output "Defender is not running, skipping exclusions"
}
Write-Output "Downloading platform-tools-latest-windows.zip to $env:temp ..."
Import-Module BitsTransfer
Start-BitsTransfer -Source "https://dl.google.com/android/repository/platform-tools-latest-windows.zip" -Destination "$env:temp\platform-tools-latest-windows.zip"
Write-Output "Extracting $env:temp\platform-tools-latest-windows.zip to $installPath ..."
Expand-Archive -Path "$env:temp\platform-tools-latest-windows.zip" -DestinationPath "$installPath" -Force
Write-Output "Installing Quest ADB Driver"
$PSScriptRootLegacy=split-path -parent $MyInvocation.MyCommand.Definition
Start-Process $PSScriptRootLegacy/android_winusb.inf -Verb Install
Write-Output "Done!"
Read-Host -Prompt "Press Enter to continue"
+22
View File
@@ -0,0 +1,22 @@
name "adbi"
description "Android Debug Bridge Installer"
authors "josephsmendoza"
copyright "Copyright © 2019, josephsmendoza"
license "GPL-3.0"
targetType "executable"
targetPath "bin/$PLATFORM/$ARCH"
dflags "-Llib/curl.lib" platform="windows"
configuration "application" {
excludedSourceFiles "source/cli.d"
dependency "tkd" version="1.1.13"
copyFiles \
"$TCLTK_PACKAGE_DIR/dist/$ARCH/tcl86t.dll" \
"$TCLTK_PACKAGE_DIR/dist/$ARCH/tk86t.dll" \
"$TCLTK_PACKAGE_DIR/dist/library" \
"C:/windows/system32/msvcr110.dll" \
"C:/windows/system32/vcruntime140.dll" \
platform="windows"
}
configuration "cli" {
excludedSourceFiles "source/gui.d"
}
-42
View File
@@ -1,42 +0,0 @@
Param( [Parameter()] [String[]] $installPath )
$adb=$false
$fastboot=$false
if (Get-Command "adb" -ErrorAction SilentlyContinue){
$adb=$true
}
if (Get-Command "fastboot" -ErrorAction SilentlyContinue){
$fastboot=$true
}
if($installPath.Length.Equals(0)){
if(!$adb -and $fastboot){
Write-Output "fastboot installed without adb"
Write-Output "Checking fastboot location via --version ..."
$installPath=fastboot --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
}
if($adb){
Write-Output "adb installed, checking location via --version ..."
$installPath=adb --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
}
if($installPath.Length.Equals(0)){
Write-Output "Location not found"
$installPath="C:\android-platform-tools"
}
}
Write-Output "installPath=$installPath"
if(!$adb -and !$fastboot){
Write-Output "Adding $installPath to `$PATH ..."
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$newpath = "$oldpath;$installPath"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
}
Write-Output "Downloading platform-tools-latest-windows.zip to $env:temp ..."
Import-Module BitsTransfer
Start-BitsTransfer -Source "https://dl.google.com/android/repository/platform-tools-latest-windows.zip" -Destination "$env:temp\platform-tools-latest-windows.zip"
Write-Output "Extracting $env:temp\platform-tools-latest-windows.zip to $installPath ..."
Expand-Archive -Path "$env:temp\platform-tools-latest-windows.zip" -DestinationPath "$installPath" -Force
Write-Output "Done!"
Read-Host -Prompt "Press Enter to continue"
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
-8
View File
@@ -1,8 +0,0 @@
;!@Install@!UTF-8!
RunProgram="powershell -executionpolicy bypass -file %%T\install.ps1"
;Config file generated by 7z SFX Builder v2.1. (http://sourceforge.net/projects/s-zipsfxbuilder/)
;!@InstallEnd@!
7zSFXBuilder_7zArchive=C:\Users\Josef\Documents\ADB-Installer\install.7z
7zSFXBuilder_SFXIcon=C:\Users\Josef\Documents\ADB-Installer\adb.ico
7zSFXBuilder_UseDefMod=7zsd_All_x64
7zSFXBuilder_UPXCommands=--best --all-methods
+141
View File
@@ -0,0 +1,141 @@
import std.path, std.process, std.algorithm.searching, std.stdio;
private string APPEND;
bool userMode;
version (Windows) string HOME = "HOMEPATH";
version (Posix) string HOME = "HOME";
enum LogLevel {
SILENT,
silent = SILENT,
s = SILENT,
ERROR,
error = ERROR,
e = ERROR,
INFO,
info = INFO,
i = INFO,
VERBOSE,
verbose = VERBOSE,
v = VERBOSE
}
alias SILENT = LogLevel.SILENT;
alias ERROR = LogLevel.ERROR;
alias INFO = LogLevel.INFO;
alias VERBOSE = LogLevel.VERBOSE;
LogLevel logLevel = INFO;
void function(string message, int messageMode = INFO) log;
private string append() {
if (!APPEND)
APPEND = buildNormalizedPath("Android", "SDK", "platform-tools");
return APPEND;
}
string defaultUserDir() {
version (Windows) string dir = "C:/" ~ environment.get(HOME) ~ "/AppData/Local";
version (linux) string dir = "~";
version (OSX) string dir = "~/Library";
return buildNormalizedPath(dir.expandTilde, append);
}
string defaultAllUsersDir() {
version (Windows) string dir = "C:/Program Files";
version (linux) string dir = "/opt";
version (OSX) string dir = "/Library";
return buildNormalizedPath(dir, append);
}
bool isUserDir(string installDir) {
return installDir.canFind(environment.get(HOME));
}
void installTools(string installDir) {
import std.zip, std.file, std.net.curl, std.conv;
version (Windows) string url = "https://dl.google.com/android/repository/platform-tools-latest-windows.zip";
version (OSX) string url = "https://dl.google.com/android/repository/platform-tools-latest-darwin.zip";
version (linux) string url = "https://dl.google.com/android/repository/platform-tools-latest-linux.zip";
log("Downloading");
log(url, VERBOSE);
ubyte[] data;
auto http = HTTP(url);
http.onReceive = (ubyte[] response) {
data ~= response;
return response.length;
};
http.perform();
log("Extracting");
log(installDir, VERBOSE);
auto zip = new ZipArchive(data);
foreach (zipEntry; zip.directory) {
auto extractPath = buildNormalizedPath(installDir, zipEntry.name[15 .. $]);
if (zipEntry.compressedSize != 0) {
log(zipEntry.name, VERBOSE);
if (extractPath.exists && extractPath.isDir) {
rmdirRecurse(extractPath);
} else if (!extractPath.dirName.exists)
mkdirRecurse(extractPath.dirName);
zip.expand(zipEntry);
extractPath.write(zipEntry.expandedData);
version (Posix)
setAttributes(extractPath, octal!775);
} else {
if (extractPath.exists) {
if (extractPath.isFile) {
extractPath.remove();
extractPath.mkdir();
}
} else
extractPath.mkdirRecurse();
}
}
}
void installPath(string installDir) {
import std.process : environment;
log("Adding to PATH");
string path = environment.get("PATH");
if (path.canFind(installDir)) {
log("Install folder is already in PATH");
return;
}
version (Windows) {
import std.windows.registry : Registry, Key, REGSAM;
Key env;
if (userMode) {
env = Registry.currentUser.getKey("Environment", REGSAM.KEY_ALL_ACCESS);
} else {
env = Registry.localMachine.getKey("SYSTEM").getKey("CurrentControlSet").getKey("Control")
.getKey("Session Manager").getKey("Environment", REGSAM.KEY_ALL_ACCESS);
}
path = env.getValue("Path").value_SZ;
path ~= pathSeparator ~ installDir;
env.setValue("Path", path);
//import core.sys.windows.winuser; SendNotifyMessageW(HWND_BROADCAST,WM_SETTINGCHANGE,cast(ulong)null,cast(long)"Environment");
} else {
import std.file : exists,append,write;
string profile;
string installProfile = "\nexport PATH=$PATH" ~ pathSeparator ~ installDir;
if (userMode)
profile = "~/.profile".expandTilde;
else
profile = "/etc/profile";
if (profile.exists)
append(profile, installProfile);
else {
write(profile, installProfile);
}
}
log("logout or reboot to finish install");
}
+41
View File
@@ -0,0 +1,41 @@
import adbi, std.getopt;
private void log(string message, int messageMode = INFO) {
if (logLevel < messageMode)
return;
if (messageMode == ERROR) {
import std.stdio : stderr;
stderr.writeln(message);
} else {
import std.stdio : writeln;
writeln(message);
}
}
void main(string[] args) {
adbi.log = &cli.log;
string installDir;
try {
auto xargs = getopt(args,
"user-mode|u", "Install for current user only instead of all users.", &userMode,
"install-dir|i", "Path to install folder.", &installDir,
"log-level|l", "silent, error, info, or verbose", &logLevel);
if (xargs.helpWanted) {
defaultGetoptPrinter("Install Android Platform Tools", xargs.options);
return;
}
if (!installDir) {
if (userMode)
installDir = defaultUserDir;
else
installDir = defaultAllUsersDir;
} else if (installDir.isUserDir)
userMode = true;
installTools(installDir);
installPath(installDir);
} catch (Exception e) {
log(cast(string) e.message, ERROR);
}
}
+144
View File
@@ -0,0 +1,144 @@
import tkd.tkdapplication;
import adbi;
import std.concurrency, std.parallelism, std.process, std.file, std.regex,
std.path, std.string, std.algorithm.searching;
import core.time;
class Application : TkdApplication {
enum {
STATUS = LogLevel.max + 1,
INSTRUCT,
OPTION,
KILL
}
static void search() {
version (Windows) {
string regex = "(.*)(\\\\)(adb.exe|fastboot.exe)($)";
string[] dirs = [
"C:\\Program Files", "C:\\Program Files (x86)",
"C:"~environment.get("HOMEPATH"), "C:\\"
];
} else
string regex = "(.*)(\\/)(adb|fastboot)($)";
version (linux) string[] dirs = ["/usr", "/opt"];
version (OSX) string[] dirs = ["/Library", "/Applications"];
version (Posix)
dirs ~= ["~".expandTilde, "/"];
adbi.log = &Application.log;
string[] results;
void search(DirEntry dir) {
try {
foreach (DirEntry d; dirEntries(dir.name, SpanMode.shallow)) {
receiveTimeout(seconds(-1), delegate(int i) {
if (i != KILL) {
log("Unsupported signal received by search thread", ERROR);
return;
} else
return;
});
if (d.isDir)
search(d);
else if (d.name.matchFirst(regex)) {
string s = d.name.dirName.strip;
if (!results.canFind(s) && s != "") {
results ~= s;
log(s, OPTION);
}
}
}
} catch (Exception e) {
log(cast(string) e.message, ERROR);
}
}
log("Searching for install locations");
log(defaultAllUsersDir, OPTION);
log(defaultUserDir, OPTION);
log("Select install location", INSTRUCT);
results ~= [defaultAllUsersDir, defaultUserDir];
foreach (string dir; dirs) {
search(DirEntry(dir));
}
}
private Frame frame;
private Label instructionLabel;
private Label statusLabel;
private Tid searchThread;
static void log(string message, int messageMode = INFO) {
ownerTid.send(messageMode);
ownerTid.send(message);
}
int mode;
private void receiveInt(int i) {
mode = i;
}
static void install(string dir) {
adbi.log = &Application.log;
if (dir.isUserDir)
adbi.userMode = true;
try {
log("Please Wait", INSTRUCT);
adbi.installTools(dir);
adbi.installPath(dir);
log("You can close this window", INSTRUCT);
} catch (Exception e) {
log(cast(string) e.message, ERROR);
}
}
private void receiveString(string message) {
switch (mode) {
case INFO:
case STATUS:
statusLabel.setText(message);
break;
case INSTRUCT:
instructionLabel.setText(message);
break;
case OPTION:
new Button(message).setCommand(delegate(CommandArgs args) {
spawn(&install, message);
}).pack();
break;
case ERROR:
import std.stdio;
stderr.writeln(message);
break;
default:
break;
}
mode = INFO;
}
private void idleCommand(CommandArgs args) {
this.mainWindow.setIdleCommand(&idleCommand);
receiveTimeout(seconds(-1), &receiveString, &receiveInt);
}
private void exitCommand(CommandArgs args) {
this.exit();
}
override protected void initInterface() {
frame = new Frame().pack();
instructionLabel = new Label(frame, "Please wait").pack();
statusLabel = new Label(frame, "Loading").pack();
this.mainWindow.setIdleCommand(&idleCommand);
this.mainWindow.setProtocolCommand(WindowProtocol.deleteWindow, &exitCommand);
searchThread = spawn(&search);
}
}
void main() {
adbi.log = &Application.log;
auto app = new Application();
app.run();
}