Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f$_& off #286

Open
wants to merge 30 commits into
base: end-game
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bb5405b
Added script and flow to move home internally.
MatthewTighe Mar 28, 2017
c04318f
Added fresh install and reinstall compatibility.
MatthewTighe Mar 28, 2017
17e27ae
Copied launchProot changes to armel and i386 assets.
MatthewTighe Mar 28, 2017
ff48e21
Moved from doing work on bash side to java side.
MatthewTighe Mar 29, 2017
563744d
Cleaned up some minor things.
MatthewTighe Mar 29, 2017
18c41a5
Got rid of testing code that was commented out.
MatthewTighe Mar 29, 2017
dd0ffd3
Merge pull request #1 from MatthewTighe/post-git-home-working
MatthewTighe Mar 29, 2017
90f173a
Fixed for user preservation across reinstallation.
MatthewTighe Mar 29, 2017
4a6d05f
Deleted commented code.
MatthewTighe Mar 29, 2017
ef54259
Committing new scripts.
MatthewTighe Mar 30, 2017
c4f4169
Committing work.
MatthewTighe Mar 31, 2017
59e5a8e
Added db binaries for other architectures.
MatthewTighe Apr 1, 2017
68167ff
Committing changes.
MatthewTighe Apr 6, 2017
bc4a5ea
Commit before shifting gears to notification and separate servers.
MatthewTighe Apr 7, 2017
a3d9a62
Added basic wireframes for GNURoot Server notification and associated…
MatthewTighe Apr 11, 2017
b8501c3
Server settings are now saved as shared app preferences.
MatthewTighe Apr 11, 2017
393ce6d
Added some comments, changed checkbox automation, and starting trying…
MatthewTighe Apr 11, 2017
d047937
Added a launcher service and switched everything to it.
MatthewTighe Apr 21, 2017
7699c77
Added vnc support, and more OO type design. Basics seem to be working…
MatthewTighe Apr 28, 2017
7873be1
Finished dropbear support.
MatthewTighe May 19, 2017
24f778c
Merge pull request #3 from MatthewTighe/dropbear_working
MatthewTighe May 19, 2017
7967dbc
Added internal password representation.
MatthewTighe May 24, 2017
67057e4
Fixed bugs in internal representation.
MatthewTighe May 25, 2017
ddcb3d7
Merge branch 'master' into master
corbinlc May 26, 2017
7083d9d
Merge pull request #161 from MatthewTighe/master
corbinlc May 26, 2017
03f073f
Added password support, created string resources, and added clarifyin…
MatthewTighe Jun 2, 2017
38514ef
Merge pull request #4 from MatthewTighe/password_working
MatthewTighe Jun 2, 2017
acabb48
Added commented signature checking.
MatthewTighe Jun 2, 2017
f7ffce8
Update README.md
MatthewTighe Jun 2, 2017
58ae2bb
Merge pull request #177 from MatthewTighe/master
corbinlc Jun 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions GNURootDebianSource/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ model {
android.productFlavors {
create("armel") {
applicationId "com.gnuroot.debian"
versionName "0.6.11_armel"
versionCode 73
versionName "0.6.12_armel"
versionCode 76
ndk.with {
abiFilters.add("armeabi")
}
Expand All @@ -40,8 +40,8 @@ model {
}
create("armhf") {
applicationId "com.gnuroot.debian"
versionName "0.6.11_armhf"
versionCode 74
versionName "0.6.12_armhf"
versionCode 77
ndk.with {
abiFilters.add("armeabi-v7a")
}
Expand All @@ -55,8 +55,8 @@ model {
}
create("i386") {
applicationId "com.gnuroot.debian"
versionName "0.6.11_i386"
versionCode 75
versionName "0.6.12_i386"
versionCode 78
ndk.with {
abiFilters.add("x86")
}
Expand Down
13 changes: 13 additions & 0 deletions GNURootDebianSource/src/armel/assets/WHERE_ARE_MY_FILES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
In an effort to make GNURoot Debian more compatible with all
Linux applications, we have moved your home directory from
external to internal storage. External storage spaces often
don't allow executables, and because of the way Android handles
file permissions GNURoot can't perform a lot of it's nifty
behind-the-scenes work in external storage either.

That being said, you can reach the old home directory if you
need to for any by navigating to

/sdcard/GNURoot/home

Thanks for your patience as we continue to perfect our app!
2 changes: 2 additions & 0 deletions GNURootDebianSource/src/armel/assets/changeSSHPasswd.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /bin/bash
echo user:$1 | sudo chpasswd
20 changes: 20 additions & 0 deletions GNURootDebianSource/src/armel/assets/changeVNCPasswd.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/bash
rm /home/user/.vnc/passwd

prog="/usr/bin/vncpasswd"
pass=$1
ans="n"

/usr/bin/expect <<EOF
spawn "$prog"
expect "Password:"
send "$pass\r"
expect "Verify:"
send "$pass\r"
expect "Would you like to enter a view-only password (y/n)?"
send "$ans\r"
expect eof
exit
EOF

exit
Binary file not shown.
Binary file added GNURootDebianSource/src/armel/assets/dropbear.mp2
Binary file not shown.
Binary file not shown.
20 changes: 19 additions & 1 deletion GNURootDebianSource/src/armel/assets/execInProot.replace.mp2
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,23 @@ echo " |_| |___||_| |__,||___||_ ||_|_||___|"
echo " |___| "
echo -e "${NC}"

#set path variables
export PATH=$PATH:/usr/games
export PATH=$PATH:/usr/local/games
export PATH=$PATH:/bin
export PATH=$PATH:/sbin
export PATH=$PATH:/usr/bin
export PATH=$PATH:/usr/sbin
export PATH=$PATH:/usr/local/bin
export PATH=$PATH:/usr/local/sbin

#set environment variables
export HOME="/home"
export PS1="> "
export TMPDIR="/tmp"
export LD_LIBRARY_PATH=" "
export LD_PRELOAD=" "
export USER="root"

#launch PRoot
PROOT_TMP_DIR=ROOT_PATH/support/ ROOT_PATH/support/proot -r ROOT_PATH/debian -v -1 -p -H -0 -l -L -b /sys -b /dev -b /proc -b /data -b /mnt -b /proc/mounts:/etc/mtab -b /:/host-rootfs -b SDCARD_GNU_PATH/intents:/intents -b SDCARD_GNU_PATH/home:/home -b SDCARD_PATH:/sdcard -b ROOT_PATH/support/:/support -b ROOT_PATH/support/ld.so.preload:/etc/ld.so.preload EXTRA_BINDINGS $@
PROOT_TMP_DIR=ROOT_PATH/support/ ROOT_PATH/support/proot -r ROOT_PATH/debian -v -1 -p -H -0 -l -L -b /sys -b /dev -b /proc -b /data -b /mnt -b /proc/mounts:/etc/mtab -b /:/host-rootfs -b SDCARD_GNU_PATH/intents:/intents -b SDCARD_PATH:/sdcard -b ROOT_PATH/support/:/support -b ROOT_PATH/support/ld.so.preload:/etc/ld.so.preload EXTRA_BINDINGS $@
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/support/busybox sh

/support/installPackages gnuroot_x_package libgl1-mesa-swx11 tightvncserver xterm xfonts-base twm
/support/installPackages gnuroot_x_package libgl1-mesa-swx11 tightvncserver xterm xfonts-base twm expect
26 changes: 24 additions & 2 deletions GNURootDebianSource/src/armel/assets/installXSupport.replace.mp2
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
#!/support/busybox sh
#!/bin/bash

/support/untargz gnuroot_x_support /support/xsupport
if [ ! -h /support/.gnuroot_x_support_passed ] && [ ! -e /support/.gnuroot_x_support_passed ]; then
echo "Installing xterm support..."
/support/busybox tar -xzvf /support/xsupport.tar.gz -C /home/user
if [[ $? == 0 ]]; then
touch /support/.gnuroot_x_support_passed
else
exit
fi
fi

if [ ! -h /support/.gnuroot_x_package_passed ] && [ ! -e /support/.gnuroot_x_package_passed ]; then
echo "Installing xterm packages..."
/support/installXPackages
if [ ! -f /support/.gnuroot_x_package_passed ]; then
exit
fi
fi

export DROPBEAR_PASSWORD="$1"
shift
/support/dbclient -y [email protected]/2022 /support/changeVNCPasswd $1

exit
12 changes: 12 additions & 0 deletions GNURootDebianSource/src/armel/assets/launchProot.replace.mp2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ if [ ! -h ROOT_PATH/support/.gnuroot_rootfs_passed ] && [ ! -e ROOT_PATH/support
if [ ! -f ROOT_PATH/support/.gnuroot_rootfs_passed ]; then
exit
fi
# During reinstallation, these files are moved outside the rootfs to preserve them
# but need to be moved back after the new rootfs has been installed, since /etc will
# otherwise be overwritten.
if [ -f ROOT_PATH/shadow ]; then
mv ROOT_PATH/shadow ROOT_PATH/debian/etc/shadow
fi
if [ -f ROOT_PATH/passwd ]; then
mv ROOT_PATH/passwd ROOT_PATH/debian/etc/passwd
fi
if [ -f ROOT_PATH/passwd- ]; then
mv ROOT_PATH/passwd- ROOT_PATH/debian/etc/passwd-
fi
fi

if [ ! -h ROOT_PATH/support/.gnuroot_patch_passed ] && [ ! -e ROOT_PATH/support/.gnuroot_patch_passed ]; then
Expand Down
37 changes: 3 additions & 34 deletions GNURootDebianSource/src/armel/assets/launchXterm.replace.mp2
Original file line number Diff line number Diff line change
@@ -1,37 +1,6 @@
#!ROOT_PATH/support/busybox sh

ROOT_PATH/support/busybox clear
DROPBEAR_PASSWORD=$1
shift

if [ ! -h ROOT_PATH/support/.gnuroot_rootfs_passed ] && [ ! -e ROOT_PATH/support/.gnuroot_rootfs_passed ]; then
echo "Installing new rootfs..."
ROOT_PATH/support/execInProot /support/installRootfs
if [ ! -f ROOT_PATH/support/.gnuroot_rootfs_passed ]; then
exit
fi
fi

if [ ! -h ROOT_PATH/support/.gnuroot_patch_passed ] && [ ! -e ROOT_PATH/support/.gnuroot_patch_passed ]; then
echo "Patching rootfs..."
ROOT_PATH/support/execInProot /support/patchRootfs
if [ ! -f ROOT_PATH/support/.gnuroot_patch_passed ]; then
exit
fi
fi

if [ ! -h ROOT_PATH/support/.gnuroot_x_support_passed ] && [ ! -e ROOT_PATH/support/.gnuroot_x_support_passed ]; then
echo "Installing xterm support..."
ROOT_PATH/support/execInProot /support/untargz gnuroot_x_support /support/xsupport.tar.gz
if [ ! -f ROOT_PATH/support/.gnuroot_x_support_passed ]; then
exit
fi
fi

if [ ! -h ROOT_PATH/support/.gnuroot_x_package_passed ] && [ ! -e ROOT_PATH/support/.gnuroot_x_package_passed ]; then
echo "Installing xterm packages..."
ROOT_PATH/support/execInProot /support/installXPackages
if [ ! -f ROOT_PATH/support/.gnuroot_x_package_passed ]; then
exit
fi
fi

ROOT_PATH/support/execInProot /support/startX $@
ROOT_PATH/support/startDBClient $DROPBEAR_PASSWORD /support/startX $@
7 changes: 5 additions & 2 deletions GNURootDebianSource/src/armel/assets/patchRootfs.replace.mp2
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/support/busybox sh

#get rid of package installation for now
#/support/installPackages gnuroot_patch sudo dropbear
touch /support/.gnuroot_patch_passed
# /support/installPackages gnuroot_patch sudo
dpkg -i /support/sudo.deb
if [ $? == 0 ]; then
touch /support/.gnuroot_patch_passed
fi
14 changes: 14 additions & 0 deletions GNURootDebianSource/src/armel/assets/startDBClient.replace.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!ROOT_PATH/support/busybox sh

export DROPBEAR_PASSWORD=$1
shift

# If we're starting X, it should be in the background, which means using the -t option will cause failure.
if [ $1 == '/support/startX' ] || [ $1 == '/support/startVNCServer' ] || [ $1 == "button_pressed" ] || [ $1 == "background" ]; then
if [ $1 == "background" ]; then
shift
fi
ROOT_PATH/support/dbclient -y [email protected]/2022 "$@" 2> ROOT_PATH/support/.DBCErrX.txt
else
ROOT_PATH/support/dbclient -yt [email protected]/2022 "$@" 2> ROOT_PATH/support/.DBCErr.txt
fi
25 changes: 25 additions & 0 deletions GNURootDebianSource/src/armel/assets/startDBServer.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /bin/bash

if id "user" >/dev/null 2>&1; then
:
else
groupadd -g 1500 user
useradd -m -u 1500 -g 1500 user
echo user:gnuroot | chpasswd
adduser user sudo
fi

if [ ! -d /etc/dropbear ]; then
mkdir /etc/dropbear
fi

if [ ! -f /etc/dropbear/dropbear_dss_host_key ]; then
/support/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
fi

if [ ! -f /etc/dropbear/dropbear_rsa_host_key ]; then
/support/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
fi

/support/dropbear &
touch /support/.dropbear_running
40 changes: 40 additions & 0 deletions GNURootDebianSource/src/armel/assets/startServers.replace.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!ROOT_PATH/support/busybox sh

DROPBEAR_PASSWORD=$1
shift

# Start a dropbear server if one isn't running
if [[ "$1" == "dropbear" ]]; then
ps -ef | grep dropbear | grep -v "grep" | grep -v "startServer"
if [[ $? == 1 ]]; then
ROOT_PATH/support/launchProot /support/startDBServer
else
touch ROOT_PATH/support/.dropbear_running
fi

if [[ "$2" == "vnc" ]]; then
# start a VNC server through dropbear if both servers are to be started
while [ ! -f ROOT_PATH/support/.dropbear_running ]; do
sleep 1
done

ps -ef | grep Xtightvnc | grep -v "grep" | grep -v "startServer"
if [[ $? == 1 ]]; then
ROOT_PATH/support/startDBClient $DROPBEAR_PASSWORD /support/startVNCServer
else
touch ROOT_PATH/support/.vnc_running
fi
fi
# Exit once both have been started
exit
fi

# Start a vnc server if one isn't running, and dropbear isn't required
if [[ "$1" == "vnc" ]]; then
ps -ef | grep Xtightvnc | grep -v "grep" | grep -v "startServer"
if [[ $? == 1 ]]; then
ROOT_PATH/support/execInProot /support/startVNCServer
else
touch ROOT_PATH/support/.vnc_running
fi
fi
9 changes: 9 additions & 0 deletions GNURootDebianSource/src/armel/assets/startVNCServer.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/bash
if [ ! -f /home/user/.vnc/passwd ]; then
tar -xzvf /support/xsupport.tar.gz -C /home/user/
fi
rm /tmp/.X51-lock
rm /tmp/.X11-unix/X51
HOME=/home/user tightvncserver -kill :51
HOME=/home/user tightvncserver -geometry 1024x768 :51
touch /support/.vnc_running
23 changes: 3 additions & 20 deletions GNURootDebianSource/src/armel/assets/startX.mp2
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,13 @@

if [[ "$1" == "button_pressed" ]]; then
shift
rm -f /support/.gnuroot_x_running
ps -a | grep xterm
rm /support/.gnuroot_x_running
ps -e | grep xterm
if [[ $? == 0 ]]; then
touch /support/.gnuroot_x_running
rm -f /support/.gnuroot_x_started
exit
fi
fi

ps -a | grep Xtightvnc
if [[ $? == 0 ]]; then
cp /root/.Xauthority /home/.Xauthority
DISPLAY=localhost:51 xterm -geometry 80x24+0+0 -e $@ &
blue='\033[0;34m'; NC='\033[0m'; echo -e "${blue}Killing this terminal will kill your xterm"
echo -e "${NC}"
touch /support/.gnuroot_x_started
else
rm /tmp/.X51-lock
rm /tmp/.X11-unix/X51
HOME=/root tightvncserver -kill :51
HOME=/root tightvncserver -geometry 1024x768 :51
cp /root/.Xauthority /home/.Xauthority
DISPLAY=localhost:51 xterm -geometry 80x24+0+0 -e $@ &
blue='\033[0;34m'; NC='\033[0m'; echo -e "${blue}Killing this terminal will kill your vnc server and xterm"
echo -e "${NC}"
touch /support/.gnuroot_x_started
fi
DISPLAY=localhost:51 xterm -geometry 80x24+0+0 -e $@ &
Binary file not shown.
4 changes: 2 additions & 2 deletions GNURootDebianSource/src/armel/assets/untargz.replace.mp2
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/support/busybox sh

if [ ! -f /host-rootfs/$2 ]; then
/support/busybox tar -xzvf $2
/support/busybox tar -xzvf $2 -C /
else
/support/busybox tar -xzvf /host-rootfs/$2
/support/busybox tar -xzvf /host-rootfs/$2 -C /
fi

if [[ $? == 0 ]]; then
Expand Down
14 changes: 14 additions & 0 deletions GNURootDebianSource/src/armel/assets/waitForInstall.replace.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! ROOT_PATH/support/busybox sh

ROOT_PATH/support/busybox clear

while [ ! -f ROOT_PATH/support/.dropbear_running ]; do
touch ROOT_PATH/support/.waiting
echo "Waiting for installation to complete..."
sleep 10
done

rm ROOT_PATH/support/.waiting

# $1 is user password
ROOT_PATH/support/startDBClient $1 /bin/bash
Binary file modified GNURootDebianSource/src/armel/assets/xsupport.mp3
Binary file not shown.
13 changes: 13 additions & 0 deletions GNURootDebianSource/src/armhf/assets/WHERE_ARE_MY_FILES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
In an effort to make GNURoot Debian more compatible with all
Linux applications, we have moved your home directory from
external to internal storage. External storage spaces often
don't allow executables, and because of the way Android handles
file permissions GNURoot can't perform a lot of it's nifty
behind-the-scenes work in external storage either.

That being said, you can reach the old home directory if you
need to for any by navigating to

/sdcard/GNURoot/home

Thanks for your patience as we continue to perfect our app!
2 changes: 2 additions & 0 deletions GNURootDebianSource/src/armhf/assets/changeSSHPasswd.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /bin/bash
echo user:$1 | sudo chpasswd
20 changes: 20 additions & 0 deletions GNURootDebianSource/src/armhf/assets/changeVNCPasswd.mp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/bash
rm /home/user/.vnc/passwd

prog="/usr/bin/vncpasswd"
pass=$1
ans="n"

/usr/bin/expect <<EOF
spawn "$prog"
expect "Password:"
send "$pass\r"
expect "Verify:"
send "$pass\r"
expect "Would you like to enter a view-only password (y/n)?"
send "$ans\r"
expect eof
exit
EOF

exit
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading