28 Commits
0.1 .. 1
Author SHA1 Message Date
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
Joseph Mendoza bceedf2702 added windefend exclusions to sidequest version 2019-06-16 20:40:20 -07:00
Joseph Mendoza 1cffefcadf added sidequest version 2019-06-16 15:34:43 -07:00
Joseph mendozaandGitHub 82514fc7d2 Update README.md 2019-06-13 03:40:50 -07:00
9 changed files with 176 additions and 55 deletions
+5 -5
View File
@@ -1,12 +1,12 @@
# ADB-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/)
+130
View File
@@ -0,0 +1,130 @@
/+ dub.sdl:
targetPath "bin/$PLATFORM/$ARCH"
+/
import std.path;
import std.stdio : writeln;
import std.algorithm.searching : canFind;
import std.process : environment;
bool sys,user,silent,verbose;
string installDir;
int installTools(){
import std.zip,std.conv,std.file,std.net.curl,std.conv : octal;
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";
ubyte[] data;
auto http=HTTP(url);
http.onReceive=(ubyte[] response){
data~=response;
return response.length;
};
http.perform();
"Download complete".writeln();
auto zip=new ZipArchive(data);
foreach (x;zip.directory){
auto path=buildNormalizedPath(installDir,x.name[15 .. $]);
if(x.compressedSize!=0){
if(!path.dirName.exists) path.dirName.mkdirRecurse();
if(path.exists) path.remove();
zip.expand(x);
write(path, x.expandedData);
setAttributes(path,octal!775);
} else {
try if(path.isFile) {
path.remove;
path.mkdirRecurse;
} catch (Exception e) path.mkdirRecurse;
}
}
"Extraction complete".writeln();
return 0;
}
int installPath(){
string path=environment.get("PATH");
if(path.canFind(installDir)){
"Install folder is already in PATH".writeln;
return 0;
}
version(Windows){
import std.windows.registry;
Key env;
if(user){
env=Registry.currentUser.getKey("Environment",REGSAM.KEY_ALL_ACCESS);
}
if(sys){
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 : append;
if(user) append("~/.profile".expandTilde,"\nexport PATH=$PATH"~pathSeparator~installDir);
if(sys) append("/etc/profile","\nexport PATH=$PATH"~pathSeparator~installDir);
}
"Install folder was added to PATH".writeln();
"logout/login or reboot to coplete install".writeln();
return 0;
}
int install(){
if(user) "Installing for current user".writeln();
if(sys) "Installing for all users".writeln();
("Installing to " ~ installDir).writeln();
return installTools() + installPath();
}
int main(string[] args){
import std.getopt : getopt,defaultGetoptPrinter;
auto xargs=getopt(args,
"all-users|a","Install for all users.",&sys,
"user|u","Install for current user.",&user,
//"silent|s","Silent standard output.",&silent,
//"verbose|v","Verbose standard output.",&verbose,
"install-dir|i","Install to specified directory",&installDir
);
if(installDir){
installDir=installDir.buildNormalizedPath.absolutePath;
if(!sys && !user){
string allHome="~".expandTilde.dirName;
if(!allHome.isRooted && installDir.canFind(allHome)) user=true;
else sys=true;
}
return install();
}
if(user || sys){
auto append=buildNormalizedPath("Android","SDK","platform-tools");
if(user){
version(Windows)installDir=buildNormalizedPath(environment.get("LocalAppData"),append);
version(linux)installDir=buildNormalizedPath("~".expandTilde,append);
version(OSX)installDir=buildNormalizedPath("~/Library".expandTilde,append);
return install();
}
if(sys){
version(Windows)installDir=buildNormalizedPath(environment.get("ProgramFiles"),append);
version(linux)installDir=buildNormalizedPath("/opt",append);
version(OSX)installDir=buildNormalizedPath("/Library",append);
return install();
}
}
defaultGetoptPrinter("Download platform-tools and add to PATH.",xargs.options);
return 0;
}
+3
View File
@@ -0,0 +1,3 @@
@echo off
%~dp0\adbi.exe %*
pause
+2
View File
@@ -0,0 +1,2 @@
dub build --single adbi.d
ptiso create -z lzma -c crc32 -x stub ptse_cmd.stub -x runas admin -x mount_system_visible 0 -x process_visible 1 -x run_relative 1 -x use_stderr 1 -x run_exe adbi.cmd -x icon adb.ico ADB-Installer.exe bin/windows/x86_64
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
dub build --single adbi.d
upx --best bin/linux/x86_64/adbi
+3
View File
@@ -0,0 +1,3 @@
/+ dub.sdl
sourceFiles "adbi.d"
+/
+30
View File
@@ -0,0 +1,30 @@
/+ dub.sdl:
dependency "tkd" version="1.1.13"
targetPath "bin/$PLATFORM/$ARCH"
copyFiles \
"$TCLTK_PACKAGE_DIR/dist/$ARCH/tcl86t.dll" \
"$TCLTK_PACKAGE_DIR/dist/$ARCH/tk86t.dll" \
"$TCLTK_PACKAGE_DIR/dist/library" \
platform="windows"
+/
import tkd.tkdapplication;
class GUI : TkdApplication
{
override protected void initInterface()
{
auto frame = new Frame().pack(5);
new Label(frame, "Select an install location").pack(0);
auto searchLabel=new Label(frame,"Searching for pre-existing files...").pack(0);
new Button(frame, "System").pack(0);
new Button(frame, "User").pack(0);
new Button(frame, "Mixed").pack(0);
}
}
void main(string[] args)
{
auto gui = new GUI();
gui.run();
}
-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"
-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