Skip to content

Instantly share code, notes, and snippets.

@gustavomdsantos
Last active December 22, 2015 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gustavomdsantos/0d30c1283d24b719d0cb to your computer and use it in GitHub Desktop.
Save gustavomdsantos/0d30c1283d24b719d0cb to your computer and use it in GitHub Desktop.
[avd-launcher] Trechos de código e de artefatos para uma próxima versão do AVD Launcher https://github.com/gustavosotnas/avd-launcher
#! /bin/bash
# Author: Gustavo Moraes <gustavosotnas1@gmail.com>
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file COPYING in the main directory of this archive
# for more details.
# Script para obter o número da versão do AVD Launcher.
#
# Ao invés de escrever o novo número da versão nos arquivos "control",
# "avd-launcher.sh" e "avd-launcher-helper.sh" toda vez que lançar uma
# nova versão, referenciando este script nos outros scripts (exceto no "control")
# facilitará a entrega do pacote Deb com o número da versão correto em
# cada um dos scripts.
# Função que identifica o gerenciador de pacotes usado no sistema
# através da identificação da distribuição GNU/Linux atual.
# Código adaptado de: http://unix.stackexchange.com/a/46086
identify_package_manager()
{
declare -A package_manager; # variável local
package_manager[/etc/redhat-release]=yum # "Yellowdog Updater, Modified" package manager for RPM (RedHat Package Manager) systems: CentOS, Fedora
package_manager[/etc/arch-release]=pacman # "Package Manager", for Arch Linux
package_manager[/etc/gentoo-release]=emerge # "Portage" package manager, for Gentoo
package_manager[/etc/SuSE-release]=zypper # "Zypp" package manager, for OpenSUSE, Tizen
package_manager[/etc/debian_version]=dpkg # "Debian package" manager, for Debian systems: Ubuntu, Mint, Kali
for f in ${!package_manager[@]}
do
if [[ -f $f ]];then
echo "${package_manager[$f]}"; # return $package_manager
fi
done
}
identify_package_manager;
# if dpkg -s avd-launcher &>/dev/null # Se o pacote "avd-launcher" foi encontrado (stdout e stderr vão para o "Buraco Negro")
# then
# VERSION="$(2>/dev/null dpkg -s avd-launcher | grep 'Version' | cut -d':' -f2 | xargs echo)" # stderr vai para o "Buraco Negro"
# echo "$VERSION";
# else
# echo "Not installed";
# fi
#if adb pull - (...) else "Error";
#! /bin/bash
# Author: Gustavo Moraes <gustavosotnas1@gmail.com>
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file COPYING in the main directory of this archive
# for more details.
# Script que exemplifica como será feito o encapsulamento das funções numa
# próxima versão do AVD Launcher no padrão MVC (Model-View-Controller).
#
# Esse script não funciona de fato, é apenas para visualizar o que será feito.
alias view.Helper="./view/Helper.sh"
funcaoQualquer()
{
view.Helper about;
}
funcaoQualquer;
x-terminal-emulator -e echo "Teste." # Executa algum comando no terminal padrão
yad --center --icons --window-icon="android" \
--item-width="150" --single-click --read-dir="./desktopfiles/" \
--width="340" --height="430" \
--title="Android Virtual Device Manager" \
--name="Android Virtual Device Manager" \
--button=About:"./avd-launcher-helper.sh about" \
--button="Close:1"; # Deve ser executado na pasta (...)'/usr/share/avd-launcher/'
Package: avd-launcher
Version: 0.2.0
Section: devel
Maintainer: Gustavo Moraes <gustavosotnas1@gmail.com>
Homepage: https://github.com/gustavosotnas/avd-launcher
Installed-Size: 89
Priority: optional
Architecture: all
Depends: yad, zenity, wmctrl
Description: Android Virtual Device Launcher
AVD Launcher is a simple tool that allows you to launch Android SDK Emulator,
without opening Android Studio or using command-line interface (terminal).
.
You can also perform some operations with Android Virtual Device (AVD) opened:
Install and Uninstall APKs, copy files to the AVD or AVD to the computer,
install Google Apps (Android 4.3+ only) and send adb commands to the AVD.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment