This repository was archived by the owner on Jan 24, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 53
adding kill-debian.sh script #156
Open
SDkie
wants to merge
2
commits into
guardianproject:master
Choose a base branch
from
SDkie:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/data/data/info.guardianproject.lildebi/app_bin/sh | ||
|
|
||
| # get full debug output | ||
| set -x | ||
|
|
||
| apt-get update | ||
| apt-get install -y fakeroot libc-bin dpkg x11-xserver-utils xfce4-panel xfdesktop4 xfwm4 xfce4-session thunar xfconf xfce4-settings tango-icon-theme apt synaptic apt-xapian-index xterm locales fonts-droid libgl1-mesa-swx11 | ||
|
|
||
| # copy the start script to root home folder | ||
| cp /data/data/info.guardianproject.lildebi/app_bin/start-xfce.sh /root/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #!/data/data/info.guardianproject.lildebi/app_bin/sh | ||
| # | ||
| # see lildebi-common for arguments, the args are converted to vars there. The | ||
| # first arg $1 is the "app payload" directory, where the included scripts are | ||
| # kept. | ||
|
|
||
| # many phones don't even include 'test', so set the path to our | ||
| # busybox tools first, where we provide all the UNIX tools needed by | ||
| # this script | ||
| export PATH=$1:$PATH | ||
|
|
||
| test -e $1/lildebi-common || exit 1 | ||
| . $1/lildebi-common | ||
|
|
||
| echo -n "Asking all processes to terminate..." | ||
| # first send TERM | ||
| for root in /proc/*/root; do | ||
| if [ ! -r "$root" ] || [ ! "`readlink "$root"`" = "$mnt" ]; then | ||
| continue | ||
| fi | ||
| pid="${root#/proc/}" | ||
| pid="${pid%/root}" | ||
| kill -TERM "$pid" 2>/dev/null || true | ||
| done | ||
| # /debian/shell starts outside of the chroot, so it must be killed separately | ||
| for pid in `ps | grep '/[d]ebian/shell' | cut -b1-5`; do | ||
| kill -TERM $pid | ||
| done | ||
| sleep 1 | ||
| echo "done" | ||
| # then send KILL to force the rest to die | ||
| echo "Killing remaining processes:" | ||
| for root in /proc/*/root; do | ||
| if [ ! -r "$root" ] || [ ! "`readlink "$root"`" = "$mnt" ]; then | ||
| continue | ||
| fi | ||
| pid="${root#/proc/}" | ||
| pid="${pid%/root}" | ||
| echo "$pid `readlink $(dirname $root)/exe`" | ||
| kill -KILL "$pid" 2>/dev/null || true | ||
| done | ||
| for pid in `ps | grep '/[d]ebian/shell' | cut -b1-5`; do | ||
| echo "$pid /debian/shell" | ||
| kill -KILL $pid | ||
| done | ||
| echo "done" | ||
|
|
||
| echo -n "Unmounting everything..." | ||
| # sort reverse so it gets the nested mounts first | ||
| for mount in `cut -d ' ' -f 2 /proc/mounts | grep $mnt/ | sort -r`; do | ||
| $busybox_path/umount -f $mount | ||
| done | ||
|
|
||
| if [ x"$install_on_internal_storage" = xno ]; then | ||
| umount -d $mnt || /system/bin/umount $mnt || echo "Failed to unmount $mnt!" | ||
| fi | ||
| echo "done" | ||
|
|
||
| attached=`find_attached_loopdev` | ||
| if [ ! -z $attached ]; then | ||
| echo -n "Deleting loopback device..." | ||
| $losetup -d $attached | ||
| echo "done" | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "Debian chroot stopped and unmounted." | ||
| if [ -e $sha1file ]; then | ||
| echo -n "Calculating new SHA1 checksum of $install_path..." | ||
| $app_bin/sha1sum $install_path > $sha1file | ||
| chmod 0600 $sha1file | ||
| cp $sha1file `dirname $install_path` | ||
| echo "Done!" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/data/data/info.guardianproject.lildebi/app_bin/sh | ||
|
|
||
| # get full debug output | ||
| set -x | ||
|
|
||
| export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/system/sbin:/system/bin:/system/xbin | ||
| export DISPLAY=127.0.0.1:0 | ||
| rm -f /var/run/dbus/pid | ||
| dbus-daemon --system & | ||
| sleep 1 | ||
| dbus-launch --exit-with-session xfce4-session & | ||
|
|
||
| # NOTES: | ||
| # Before running this script | ||
| # 1) install https://play.google.com/store/apps/details?id=x.org.server application | ||
| # 2) open this application and select the display configuration | ||
| # 3) After that you can run this script or set it as post-start script in Lil'Debi application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggestion: use
grep '/debian/shell' /proc/*/comminstead of parsing ps output.