Skip to content
Browse files

add scripts

  • Loading branch information...
1 parent 226fcf9 commit 57aff36e25ca2208040cb27f0e15c814939dc518 @ghk committed Jul 8, 2011
Showing with 72 additions and 8 deletions.
  1. +21 −0 scripts/debian
  2. +5 −0 scripts/initd.txt
  3. +3 −0 scripts/scripts.txt
  4. +22 −0 scripts/start.sh
  5. +11 −0 scripts/stop.sh
  6. +5 −0 scripts/var.sh
  7. +5 −8 src/com/kaulahcintaku/debian/DebianManager.java
View
21 scripts/debian
@@ -0,0 +1,21 @@
+#!/system/bin/sh
+
+echo $*
+
+. /mnt/sdcard/external_sd/debian/var.sh
+if [ $# -eq 0 ]; then
+ su -c "chroot $mnt su root"
+elif [ $1 = "-u" ]; then
+ shift
+ if [ $# -eq 0 ]; then
+ su -c "chroot $mnt su $username"
+ else
+ su -c "chroot $mnt su $username -c \"$*\""
+ fi
+elif [ $1 = "-m" ]; then
+ su -c "cd $kit && sh start.sh"
+elif [ $1 = "-um" ]; then
+ su -c "cd $kit && sh stop.sh"
+else
+ su -c "chroot $mnt su root -c \"$*\""
+fi
View
5 scripts/initd.txt
@@ -0,0 +1,5 @@
+ssh
+proftpd
+nginx
+transmission-daemon
+pyload
View
3 scripts/scripts.txt
@@ -0,0 +1,3 @@
+Start X#/home/egoz/misc/bin/startvnc#false
+Stop X#/home/egoz/misc/bin/stopvnc#false
+SIMA Etc Host Configurer#/root/misc/bin/sehc#true
View
22 scripts/start.sh
@@ -0,0 +1,22 @@
+. ./var.sh
+
+busybox clear
+
+busybox mkdir -p $mnt
+
+busybox mount -o loop,noatime $kit/debian.img $mnt
+
+busybox mount -t devpts -o mode=777,gid=0 devpts $mnt/dev/pts
+busybox mount -t proc proc $mnt/proc
+busybox mount -t sysfs sysfs $mnt/sys
+
+busybox mkdir -p $mnt/mnt
+busybox mkdir -p $mnt/mnt/sdcard $mnt/mnt/system
+busybox mkdir -p $mnt/mnt/data $mnt/mnt/dev $mnt/mnt/external $mnt/mnt/root
+
+busybox mount -o bind /sdcard $mnt/mnt/sdcard
+busybox mount -o bind /sdcard/external_sd $mnt/mnt/external
+busybox mount -o bind /system $mnt/mnt/system
+busybox mount -o bind /data $mnt/mnt/data
+busybox mount -o bind /dev $mnt/mnt/dev
+busybox mount -t tmpfs tmpfs $mnt/tmp -o noatime,mode=1777
View
11 scripts/stop.sh
@@ -0,0 +1,11 @@
+. ./var.sh
+
+busybox umount -l $mnt/sys
+busybox umount -l $mnt/proc
+busybox umount -l $mnt/dev/pts
+busybox umount -l $mnt/mnt/external
+busybox umount -l $mnt/mnt/sdcard
+busybox umount -l $mnt/mnt/system
+busybox umount -l $mnt/mnt/data
+busybox umount -l $mnt/tmp
+busybox umount -ld $mnt/
View
5 scripts/var.sh
@@ -0,0 +1,5 @@
+export kit=/mnt/sdcard/external_sd/debian
+export mnt=/data/local/debian
+export username=egoz
+export TERM=linux
+export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
View
13 src/com/kaulahcintaku/debian/DebianManager.java
@@ -22,14 +22,11 @@
public class DebianManager extends Activity {
- private static String MOUNTED_KIT_LOCATION = "/mnt/external/debian";
- private static String UNMOUNTED_KIT_LOCATION = "/mnt/sdcard/external_sd/debian";
+ private static String KIT_LOCATION = "/mnt/sdcard/external_sd/debian";
private static String MOUNT_COMMAND = "/system/bin/debian -m";
- private static String UMOUNT_COMMAND;
- static{
- UMOUNT_COMMAND = Command.debianRootCommand("sh "+MOUNTED_KIT_LOCATION+"/stop.sh");
- }
+ private static String UMOUNT_COMMAND = "/system/bin/debian -um";
+
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -49,7 +46,7 @@ public void onClick(View v) {
}
});
- final List<String> initdScripts = readAllLines(UNMOUNTED_KIT_LOCATION+"/initd.txt");
+ final List<String> initdScripts = readAllLines(KIT_LOCATION+"/initd.txt");
ArrayAdapter<String> initdAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, initdScripts);
ListView initdView = (ListView)findViewById(R.id.initd_entry);
initdView.setAdapter(initdAdapter);
@@ -62,7 +59,7 @@ public void onItemClick(AdapterView<?> arg0, View arg1, int item,
});
configureHeight(initdView, initdAdapter);
- List<String> scriptConfigs = readAllLines(UNMOUNTED_KIT_LOCATION+"/scripts.txt");
+ List<String> scriptConfigs = readAllLines(KIT_LOCATION+"/scripts.txt");
final List<Command> commands = new ArrayList<Command>();
for(String config: scriptConfigs)
commands.add(new Command(config));

0 comments on commit 57aff36

Please sign in to comment.
Something went wrong with that request. Please try again.