Skip to content

Commit

Permalink
initial commit (v16.0)
Browse files Browse the repository at this point in the history
Brief changes by comparing to previous v15.2:

- Full support for managing files on shared storage, i.e. not limited
  to private directory anymore.

- Console font is now Inconsolata LGC patched by Nerd-Fonts.

- Updated HDD & CD-ROM system images.
  • Loading branch information
Leonid Pliushch committed Jan 28, 2021
0 parents commit f81febe
Show file tree
Hide file tree
Showing 283 changed files with 326,930 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .git-crypt/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Do not edit this file. To specify the files to encrypt, create your own
# .gitattributes file in the directory where your files are.
* !filter !diff
*.gpg binary
Binary file not shown.
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Credentials.
alpine-term-app/app/release.gradle filter=git-crypt diff=git-crypt
# Keystores.
*.jks filter=git-crypt diff=git-crypt
*.p12 filter=git-crypt diff=git-crypt
# Stored in Git LFS.
#*.bin filter=lfs diff=lfs merge=lfs -text
#*.iso filter=lfs diff=lfs merge=lfs -text
#*.qcow2 filter=lfs diff=lfs merge=lfs -text
#env-packages/jniLibs/arm64-v8a/*.so filter=lfs diff=lfs merge=lfs -text
#env-packages/jniLibs/armeabi-v7a/*.so filter=lfs diff=lfs merge=lfs -text
#env-packages/jniLibs/x86/*.so filter=lfs diff=lfs merge=lfs -text
#env-packages/jniLibs/x86_64/*.so filter=lfs diff=lfs merge=lfs -text
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Alpine Term

> Basically a text-based frontend to QEMU on Android OS.
*Telegram channel: https://t.me/alpineterm*

Alpine Term, aka Alpine Linux Terminal, is a virtual machine running the
[Alpine Linux](https://alpinelinux.org) — a security-oriented, lightweight
Linux distribution based on Musl libc and Busybox. Application started as
[Termux](https://termux.com) fork, aims to cover as much as possible of its
functionality as well as provide an experience of the true Linux-based system.

VM setup details:
- QEMU monitor console to manage VM.
- CPU: emulated 4-core (3 cores offline by default) x86 64-bit. (1\*)
- RAM (2\*): 32% of host memory + 8% for QEMU TCG buffers.
- HDD: 128 GB, paritioned & bootable.
- Optional support for custom HDD/CD-ROM images.
- Host storage: via 9P file system, mount tag `shared_storage`.
- Network: user-mode via SLiRP.
- Operating system: [Alpine Linux](https://alpinelinux.org/) installed on HDD
with lots of packages.

1. *Emulated CPU has only one core online by default. Having more is pointless
from the performance side because QEMU internally handles them in a one thread.*
2. *RAM allocations beyond 40% - 50% are not safe due to increased probability
that Android will kill application to reclaim memory.*

Requires a high-end device with at least 6 GB of space on internal storage and
also some knowledge in the shell scripting and Linux system administration.

**Disclaimer**: neither Alpine Term application nor its author is affiliated
with the [Alpine Linux](https://alpinelinux.org/) project. Operating system
is provided as-is and vShell author is not responsible about bugs in the
software packages.

<p align="center"><img src="./help-page/img/demo_anim.gif" width="90%"/></p>

## Credits

Alpine Term relies on the source code of the following projects:

- [Termux](https://github.com/termux/termux-app)
- [QEMU](https://qemu.org)
- [Socat](http://www.dest-unreach.org/socat/)
16 changes: 16 additions & 0 deletions alpine-term-app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided this notice is
# preserved. This file is offered as-is, without any warranty.

# EditorConfig
# http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
35 changes: 35 additions & 0 deletions alpine-term-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Based on https://gist.github.com/iainconnor/8605514

# Built application files
app/.cxx/
app/debug/
app/release/
build/
*.apk
.externalNativeBuild

# Local configuration file (sdk path, etc)
local.properties

# Gradle generated files
.gradle/

# Signing files
.signing/

# Intellij
.idea/
*.iml

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# System images.
*.iso
*.qcow2
123 changes: 123 additions & 0 deletions alpine-term-app/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import java.security.DigestInputStream
import java.security.MessageDigest

apply plugin: 'com.android.application'
apply from: 'release.gradle'

android {
compileSdkVersion 30
ndkVersion '22.0.7026061'

dependencies {
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
implementation "androidx.preference:preference:1.1.1"
implementation "androidx.viewpager:viewpager:1.0.0"
}

defaultConfig {
applicationId "alpine.term"
minSdkVersion 24
targetSdkVersion 30
versionCode 1600
versionName "16.0"

archivesBaseName = "alpine-term-v$versionName"

externalNativeBuild {
ndkBuild {
cFlags "-std=c11", "-Wall", "-Wextra", "-Werror", "-Os", "-fno-stack-protector", "-Wl,--gc-sections"
}
}

ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

externalNativeBuild {
ndkBuild {
path "src/main/jni/Android.mk"
}
}
}

def downloadFile(String remoteUrl, String localFile, String expectedChecksum) {
def digest = MessageDigest.getInstance("SHA-256")

def localUrl = "src/main/assets/vm_data/" + localFile
def file = new File(projectDir, localUrl)
if (file.exists()) {
def buffer = new byte[16384]
def input = new FileInputStream(file)
while (true) {
def readBytes = input.read(buffer)
if (readBytes < 0) break
digest.update(buffer, 0, readBytes)
}
def checksum = new BigInteger(1, digest.digest()).toString(16)
if (checksum == expectedChecksum) {
return
} else {
logger.quiet("Deleting old local file with wrong hash: " + localUrl)
file.delete()
}
}

logger.quiet("Downloading " + remoteUrl + " ...")

file.parentFile.mkdirs()
def out = new BufferedOutputStream(new FileOutputStream(file))

def connection = new URL(remoteUrl).openConnection()
connection.setInstanceFollowRedirects(true)
def digestStream = new DigestInputStream(connection.inputStream, digest)
out << digestStream
out.close()

def checksum = new BigInteger(1, digest.digest()).toString(16)
if (checksum != expectedChecksum) {
file.delete()
throw new GradleException("Wrong checksum for " + remoteUrl + ": expected: " + expectedChecksum + ", actual: " + checksum)
}
}

clean {
doLast {
def tree = fileTree(new File(projectDir, 'src/main/assets'))
tree.include 'alpine-linux-cdrom.iso'
tree.include 'alpine-linux-hdd.qcow2'
tree.each { it.delete() }
}
}

task getSystemImage(){
doLast {
downloadFile("https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-virt-3.13.0-x86_64.iso",
"alpine-linux-cdrom.iso",
"daa45a8c12b8458296188d64e6091da79087d47a914d90a0976f6ef92fafba28")
downloadFile("https://github.com/xeffyr/alpine-term/releases/download/v16.0/alpine-term-hdd-image-2020.01.28.qcow2",
"alpine-linux-hdd.qcow2",
"b6500a6640bd152502de8479ad12961fa6afe69b8eb78db0a97fea26d5b8ed7")
}
}

afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompileProvider.get().dependsOn(getSystemImage)
}
}
11 changes: 11 additions & 0 deletions alpine-term-app/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
Binary file added alpine-term-app/app/release.gradle
Binary file not shown.
Binary file added alpine-term-app/app/signature.jks
Binary file not shown.
73 changes: 73 additions & 0 deletions alpine-term-app/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="alpine.term"
android:installLocation="internalOnly">

<uses-feature android:name="android.hardware.touchscreen" android:required="false" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<!-- Used by Android 10 and lower. requestLegacyExternalStorage should also be set, because
application doesn't work with scoped storage mode.-->
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29" />

<application
android:extractNativeLibs="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:banner="@drawable/banner"
android:label="@string/application_name"
android:theme="@style/Theme.TermApp"
android:supportsRtl="false"
android:requestLegacyExternalStorage="true"
tools:ignore="GoogleAppIndexingWarning">

<!-- This (or rather, value 2.1 or higher) is needed to make the Samsung Galaxy S8
mark the app with "This app is optimized to run in full screen." -->
<meta-data android:name="android.max_aspect" android:value="10.0" />

<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.samsung.android.multidisplay.keep_process_alive" android:value="true"/>

<activity
android:name=".TerminalActivity"
android:label="@string/application_name"
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|uiMode|keyboard|keyboardHidden|navigation"
android:launchMode="singleTask"
android:resizeableActivity="true"
android:windowSoftInputMode="adjustResize|stateAlwaysVisible" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".StoragePermissionActivity"
android:exported="false" />

<activity
android:name=".HelpActivity"
android:exported="false"
android:theme="@android:style/Theme.Material.Light.DarkActionBar"
android:parentActivityName=".TerminalActivity"
android:resizeableActivity="true"
android:label="@string/application_name" />

<service
android:name=".TerminalService"
android:exported="false" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Scheme: Argonaut

background: #0E1019
cursor: #9F9A94
foreground: #FFFAF4

# Black + Dim grey
color0: #232323
color8: #444444

# Dim red + Bright red
color1: #FF000F
color9: #FF2740

# Dim green + Bright green
color2: #8CE10B
color10: #ABE15B

# Dim yellow + Bright yellow
color3: #FFB900
color11: #FFD242

# Dim blue + Bright blue
color4: #008DF8
color12: #0092FF

# Dim magenta + Bright magenta
color5: #6D43A6
color13: #9A5FEB

# Dim cyan + Bright cyan
color6: #00D8EB
color14: #67FFF0

# Bright grey + White
color7: #FFFFFF
color15: #FFFFFF
Loading

0 comments on commit f81febe

Please sign in to comment.