Skip to content

Commit

Permalink
Merge pull request #18 from RandomCoderOrg/revamp-v2.5
Browse files Browse the repository at this point in the history
Revamp v2.5
  • Loading branch information
b1tchysam authored Feb 9, 2023
2 parents fcbcdef + 8747076 commit 6ad3014
Show file tree
Hide file tree
Showing 67 changed files with 13,850 additions and 694 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# [Choice] Ubuntu version (use hirsuite or bionic on local arm64/Apple Silicon): hirsute, focal, bionic
ARG VARIANT=jammy
FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT}

ENV DEVCONTAINER true

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install tar fonts-firacode
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "fs-manager-udroid Dev Container v1",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: hirsute, focal, bionic
// Use hirsute or bionic on local arm64/Apple Silicon.
"args": { "VARIANT": "jammy" }
},

// Set *default* container specific settings.json values on container create.
"settings": {
"files.eol": "\n"
},


// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"tabnine.tabnine-vscode",
"lizebang.bash-extension-pack",
"shakram02.bash-beautify"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**.tmp
tmp
3 changes: 3 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
disable=SC2086
disable=SC2046
disable=SC2068
85 changes: 85 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# The contribution guidelines

Hey!, Thanks for contributing to this project. if you are in this step that means you're probably want to contribute to this project or just exploring :).

This page will guide you through the project structure and basic rules ( that keep project structure clean and understandable )

> this repo main script is referenced as **udroid** in this page.
## Directories

```cmd
.
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── dist.json
├── etc
├── install.sh
├── LICENSE
├── README.md
├── targ.map
├── udroid
└── version
```

All mainline code related to udroid will be stored in **udroid** directory. and the rest of em are either archiving or documentation. on expanding the **udroid** directory you'll two direcotries **src** and **test**.

> By name src for the source code & test for the test code.
## How udroid works

udroid in this repo is a script to manage things like installing, login of a tarball.

the main script is in `udroid/src/udroid.sh`. which will be executed when user executes `udroid` in terminal.

Basic things udroid supposed to handle are:

1. **install**: to dowload & install the linux tarball
2. **login**: to login to the linux filesystem by chaning root with the help of `proot`
3. **remove**: to remove the linux tarball installation

> if you ever tried `proot-distro` you'll get the idea of how udroid works.
> Additional functionality will like **backup** and **restore** need more work (If you have any ideas feel free to suggest us!).
## Dev FAQ?

### How this sript differ from `proot-distro`?

> the main for this project is to provide a simple script to install and use linux distros on android. and the main difference is that udroid is a single script which is easy to understand and modify. from the developer point of view now we can ship new feature faster without patching things to work specially with `proot-distro`. with this users can be able to install custom linux distro with ease.
### What languages are used in this project?

> the main script is written in `bash` and the test script (some of em) is written in `python` & `bash` (because it's easy to write test in python).
### What to contribute?

> you can contribute by writing documentation, writing diffrent test cases, new features, creating issues about bugs. even a typo fix is a contribution. You can ping us on discord if you have any questions.
### is the project accept Hacktoberfest PRs?

> Yes, we accept Hacktoberfest PRs. but we'll only accept PRs that are related to the project. if you have any questions ping us on discord.
### How can I contribute?

for starters, you can follow the basic GitHub guide [here](https://docs.github.com/en/get-started/quickstart/hello-world).

When submitting a pull request make sure to add a good title and description to it. using images is encouraged too

Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:

```cmd
$ git commit -m "A summary of the commit
>
> A paragraph describing what changed and its impact."
```

## Coding conventions

Start reading our code and you'll get the hang of it. We optimize for readability:

- use 4-6 spaces for intending to bash
- strictly use `lf` for line ending
- check the code with `shellcheck` or `pylint` before commiting.
- follow directory rules in all cases ( images should go in directories named similar to `assets` or `img` )
- use code beautification tools for better look and readability
- This is open-source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers, the goal is to make the ride as smooth as possible.
122 changes: 116 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,120 @@
# fs-manager-udroid

A tool manage common things with ubuntu-on-android
& some scripts and linux apps

[![CodeFactor](https://www.codefactor.io/repository/github/randomcoderorg/fs-manager-udroid/badge)](https://www.codefactor.io/repository/github/randomcoderorg/fs-manager-udroid)
<!--
## Target to V01
- [X] upgrade system
- [X] launch shorcuts vncserver and others ( [0530e7965907002c614e70c6f8a398c6b9d13fd8](https://github.com/RandomCoderOrg/fs-manager-udroid/commit/0530e7965907002c614e70c6f8a398c6b9d13fd8) to [5a4ee56e9219988b24204e8b49787a8f7ed3b8ef](https://github.com/RandomCoderOrg/fs-manager-udroid/commit/5a4ee56e9219988b24204e8b49787a8f7ed3b8ef) )
-->
## Manual installation

```bash
git clone https://github.com/RandomCoderOrg/fs-manager-udroid.git
cd fs-manager-udroid
bash install.sh
```

## Usage

```cmd
udroid <option> [<options>] [<suite>]:[<varient>]
options:
install, -i [<options>] <suite>:<varient> install a distro
remove, --remove <suite>:<varient> remove a distro
list, --list [options] list distros
login, --login <suite>:<varient> login to a distro
upgrade, --upgrade upgrade udroid scripts
help, --help show this help message and exit
--update-cache update cache from remote
--clear-cache clear downloaded cache
```

three main arguments `install`, `login`, `remove`

### install ( `-i` )

```bash
udroid -i jammy:raw
```

install argument takes a strings of two words seperated by `:` left side is suite name and right is varient name

More Avalible examples

```bash
udroid -i impish:raw
udroid -i impish:xfce
udroid -i impish:mate
```

```bash
udroid -i focal:xfce4
```

###### help

```cmd
udroid [ install| -i ] [<options>] [<suite>]:[<varient>]
installs udroid distros
options:
-h, --help show this help message and exit
--no-verify-integrity do not verify integrity of filesystem
example:
udroid install jammy:raw
udroid install --install jammy:raw
```

> `--install` with no extra options install best picked distro ( deprecated )
### login (`login`)

```bash
udroid --login jammy:raw
# or
udroid login jammy:raw # same as above
```

###### help
```cmd
udroid [ login| --login ] [<options>] <suite>:<varient> <cmd>
login to a suite
options:
-h, --help: show this help message and exit
--user: Allows the user to specify the login user for the filesystem.
--name: Allows the user to specify a custom name for the filesystem to install
--bind or -b: Allows the user to specify extra mount points for the filesystem.
--isolated: Creates an isolated environment for the filesystem.
--fix-low-ports: Fixes low ports for the filesystem.
--no-shared-tmp: Disables shared tmp for the filesystem.
--no-link2symlink: Disables link2symlink for the filesystem.
--no-sysvipc: Disables sysvipc for the filesystem.
--no-fake-root-id: Disables fake root id for the filesystem.
--no-cap-last-cap: Disables cap last cap fix mount for the filesystem.(only per session)
--no-kill-on-exit: Disables kill on exit for the filesystem.
<cmd>:
command to run in the filesystem and exit
```

### remove (`remove`)

```bash
udroid remove jammy:raw
```

###### help

```cmd
udroid [ remove| --remove ] <distro>
removes udroid distros
example:
udroid remove jammy:raw
udroid remove --remove jammy:raw
```

> Download cache is ignored

## Contributing

for now there is no guide for contributing. try to look at code and make a pull request if you have any corrections or improvements ( 💟 )
4 changes: 4 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- make install echo's a little less verbose by default
- show install size & download size during install ( need to cache sizes in conf )
- [ OPT ] make a deb package for udroid

33 changes: 33 additions & 0 deletions docs/adding_extra_mounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Adding shared folders

In case you want to bind directories directly from host's file system to proot container as shared folders, you can use this.

## How to apply

You can use the traditional `proot-distro` method to use `--bind` argument with paths to bind in syntax `<path in host>:<path to bind in container>` before the name of the distribution. Or custom configuration file named `udroid_proot_mounts` in container root ( at `\`) with paths to bind in format `<path in host>:<path to bind in container>`

### By using argument

In case of binding directly while launching udroid. For adding multiple bindings you can use `--bind` over and over again

```bash
udroid -l --bind /sdcard:/sdcard jammy:raw
```

> Note the way `--bind` is used before the name of the distribution `jammy:raw`
>
### By creating config file

Those binds are written in a file named `udroid_proot_mounts` in the root of the container (at `\`).

> Note that for some udroid builds there may be pre-defined custom mounts points in `udroid_proot_mounts` file. If you want to add your own mounts, you should add them to the end of the file. ( carefull while using redirections to overwrite the file, you may lose the pre-defined mounts )
If adding new binds, you can put directory names with paths like this in `udroid_proot_mounts`
```bash
/sdcard:/sdcard
/sdcard/Music:/root/ext_music
```

### Note
Due to android limitations, you cannot get external sdcard paths working like this for non-rooted devices.
24 changes: 24 additions & 0 deletions docs/audio output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Audio Output

Audio output is handled by pulseaudio from container to termux pulseaudio openSL ES sink througth tcp.

termux pulse audio initalization is done in scripts with `PULSE_SERVER` environment variable set to `127.0.0.1` and with `module-native-protocol-tcp` module loaded in termux pulseaudio.

#### example

```bash
# in termux
pulseaudio --start \
--load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" \
--exit-idle-time=-1
# in proot container
export PULSE_SERVER=127.0.0.1

```


## limitations

> sending audio packets througth tcp with vnc will cause audio lag.
>
> _for now there is no solution for this._
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions proot-env/Hidpi/hidpi/app.sh → etc/02/Hidpi/hidpi/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ DESKTOP="$XDG_CURRENT_DESKTOP"

case "$DESKTOP" in
XFCE)
;;
;;
*)
echo 'ERROR: HiDPI mode only works on Xfce desktop' >&2
notify-send -i dialog-warning 'ERROR: HiDPI mode only works on Xfce desktop'
exit 1
;;
echo 'ERROR: HiDPI mode only works on Xfce desktop' >&2
notify-send -i dialog-warning 'ERROR: HiDPI mode only works on Xfce desktop'
exit 1
;;
esac

mkdir -p "$SETTINGS_DIR"
Expand Down Expand Up @@ -53,21 +53,21 @@ disable_hidpi()
toggle_hidpi() {
if [ -r "${SETTINGS_DIR}xsession-settings" ]
then
disable_hidpi
{ sleep 5 && notify-send -i dialog-information 'HiDPI mode disabled'; } &
disable_hidpi
{ sleep 5 && notify-send -i dialog-information 'HiDPI mode disabled'; } &
else
enable_hidpi
{ sleep 5 && notify-send -i dialog-information 'HiDPI mode enabled'; } &
enable_hidpi
{ sleep 5 && notify-send -i dialog-information 'HiDPI mode enabled'; } &
fi

if [ "$DESKTOP" = 'XFCE' ]
then
killall xfce4-notifyd 2> /dev/null # Hide existing notifications
for process in xfsettingsd xfce4-panel xfdesktop
do
killall -9 $process
$process >/dev/null 2>&1 &
done
killall xfce4-notifyd 2> /dev/null # Hide existing notifications
for process in xfsettingsd xfce4-panel xfdesktop
do
killall -9 $process
$process >/dev/null 2>&1 &
done
fi
}

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6ad3014

Please sign in to comment.