On Friday 04 March 2011 08:48:11 Dudy Kohen wrote:
> Thanks for the idea, but it won't work since the /system is not mounted as
> /, and the /bin/sh path is hard coded.
> Perhaps an environment variable to set the default login shell will be a
> better option? If not I will set this in the configuration.

If you don't want to modify the boot.img
you can fix it at boot time through a userinit.sh or /etc/init.d/
script (that are supported by most roms today):

busybox mount -o remount,rw /dev/rootfs /;
busybox ln -s /system/bin/ /bin
busybox mount --bind /system/xbin/ash /system/bin/sh;
busybox mount -o remount,ro /dev/rootfs /;

Just an idea.
Ciao,
Tito
> On Mar 4, 2011 9:06 AM, "Tito" <[email protected]> wrote:
> > On Friday 04 March 2011 03:41:56 Rob Landley wrote:
> >> Don't #ifdef ANDROID and hardwire in various random strings. Make the
> >> string a config symbol with a sane default, and let people set it in
> >> their config. (If you'd like to suggest a few in the help text, fine.
> >> But I don't find the fact that Busybox is getting more brittle with time
> >> to be a comforting trend.)
> >>
> >> Rob
> >
> > Hi,
> > this could be easily fixed without code changes:
> >
> > 1) substitute /system/bin/sh with a busybox build with only ash enabled
> >
> > 2) or mount bind it at boot time
> > if [ -e /system/xbin/busybox ] ; then
> > mount --bind /system/xbin/sh /system/bin/sh;
> > fi;
> >
> > More in general to add a compatibility layer for real linux, scripts can
> be used,
> > but this is stuff for android forums ;-).
> >
> > Ciao,
> > Tito
> >
> >
> ------------------------------------------------------------------------------------------------------------------------
> > #!/system/bin/sh
> > #
> > # (C) 2009 - 2010 [email protected]
> > #
> > SYSTEM_BUILD_PROP="/system/build.prop"
> > SD_PATH="/sd-ext";
> >
> > # Modify the system - set rw
> > mount -o remount,rw /dev/mtdblock3 /system;
> > mount -o remount,rw /dev/rootfs /;
> >
> > if [ `grep -c "^/dev/block/mmcblk0p2 $SD_PATH " /proc/mounts` -eq 1 ] ;
> then
> > # Prepare dir and link for overriding system binaries
> > mkdir /usr;
> > chown root.root /usr;
> > chmod 755 /usr;
> > if [ ! -e $SD_PATH/bin ] ; then
> > mkdir $SD_PATH/bin;
> > fi;
> > chown root.shell $SD_PATH/bin;
> > chmod 755 $SD_PATH/bin;
> > busybox ln -s $SD_PATH/bin /usr/bin;
> >
> > # Prepare dir for additional libs
> > if [ ! -e $SD_PATH/lib ] ; then
> > mkdir $SD_PATH/lib;
> > fi;
> > chown root.shell $SD_PATH/lib;
> > chmod 755 $SD_PATH/lib;
> > busybox ln -s $SD_PATH/lib /usr/lib;
> >
> > find $SD_PATH/lib/ -name *.so | while read line ; do
> > name=`basename $line`;
> > busybox ln -s $line /system/lib/$name;
> > done;
> >
> > # Prepare fake home dir
> > if [ ! -e $SD_PATH/home ] ; then
> > mkdir $SD_PATH/home;
> > chown root.root $SD_PATH/home;
> > chmod 755 $SD_PATH/home;
> > fi;
> > busybox ln -s $SD_PATH/home /home;
> > busybox ln -s /system/lib /lib
> > # Use ash as default shell
> > if [ -e /usr/bin/busybox ] ; then
> > mount --bind /usr/bin/sh /system/bin/sh;
> > fi;
> >
> > # Setup fstab, mtab, passwd and group files
> > if [ ! -e $SD_PATH/etc ] ; then
> > mkdir $SD_PATH/etc;
> > fi;
> > chmod 644 $SD_PATH/etc;
> > chown root.root $SD_PATH/etc;
> > chown root.root $SD_PATH/etc/passwd;
> > chown root.root $SD_PATH/etc/group;
> > chown root.root $SD_PATH/etc/shadow;
> > chown root.root $SD_PATH/etc/gshadow;
> > chown root.root $SD_PATH/etc/fstab;
> > chown root.root $SD_PATH/etc/shells;
> > chown root.root $SD_PATH/etc/profile;
> > chmod 644 $SD_PATH/etc/passwd;
> > chmod 644 $SD_PATH/etc/group;
> > chmod 600 $SD_PATH/etc/shadow;
> > chmod 600 $SD_PATH/etc/gshadow;
> > chmod 644 $SD_PATH/etc/shells;
> > chmod 644 $SD_PATH/etc/profile;
> > if [ ! -e /etc/fstab ] ; then
> > busybox ln -s $SD_PATH/etc/fstab /etc/fstab;
> > fi;
> > chmod 644 $SD_PATH/etc/fstab;
> > busybox ln -s $SD_PATH/etc/passwd /etc/passwd;
> > busybox ln -s $SD_PATH/etc/shadow /etc/shadow;
> > busybox ln -s $SD_PATH/etc/group /etc/group;
> > busybox ln -s $SD_PATH/etc/gshadow /etc/gshadow;
> > busybox ln -s $SD_PATH/etc/shells /etc/shells;
> > busybox ln -s $SD_PATH/etc/profile /etc/profile;
> > if [ ! -e /etc/mtab ] ; then
> > busybox ln -s /proc/mounts /etc/mtab;
> > fi;
> > fi;
> >
> > # Fix scripts in /system/bin needed by busybox ash
> > for i in am ime input monkey pm svc;
> > do
> > if [ `grep -c "#!/system/bin/sh" /system/bin/$i` -eq 0 ] ; then
> > echo "#!/system/bin/sh" > /system/bin/$i.tmp;
> > cat /system/bin/$i >> /system/bin/$i.tmp;
> > mv /system/bin/$i.tmp /system/bin/$i;
> > chown root.shell /system/bin/$i;
> > chmod 755 /system/bin/$i;
> > fi;
> > done;
> >
> > # Setup resolv.conf, needed by ping
> > if [ `grep -c "208.67.222.222" /etc/resolv.conf` -eq 0 ] ; then
> > echo "nameserver 208.67.222.222" > /etc/resolv.conf;
> > echo "nameserver 208.67.220.220" >> /etc/resolv.conf;
> > setprop net.dns1 208.67.222.222;
> > setprop net.dns2 208.67.220.220;
> > fi;
> >
> > # Device compatibility
> > for i in 0 1 2 3 4 5 6 7;
> > do
> > busybox ln -s /dev/block/loop$i /dev/loop$i;
> > done;
> >
> > # Clean up /system/etc/hosts file - paranoia
> > echo "127.0.0.1 localhost" > /system/etc/hosts
> >
> > # Use our own host file as default
> > if [ -e /sd-ext/etc/hosts ] ; then
> > mount --bind /sd-ext/etc/hosts /system/etc/hosts;
> > fi;
> >
> > # Remount all ro
> > mount -o remount,ro /dev/rootfs /;
> > mount -o remount,ro /dev/mtdblock3 /system;
> >
> > exit 0;
> >
> >
> ------------------------------------------------------------------------------------------------------------------------
> >
> > _______________________________________________
> > busybox mailing list
> > [email protected]
> > http://lists.busybox.net/mailman/listinfo/busybox
> 


_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to