Skip to content

Instantly share code, notes, and snippets.

@checko
Created June 11, 2012 09:08
Show Gist options
  • Save checko/2909197 to your computer and use it in GitHub Desktop.
Save checko/2909197 to your computer and use it in GitHub Desktop.
mount and run script on external sd
#include <sys/mount.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc,char **argv)
{
int fd;
struct stat s;
if(mount("/dev/block/mmcblk1p1","/extsd","vfat",0,NULL)){
printf("mount fail!\n");
return 0;
}
if(stat("/extsd/ss.sh",&s)==0)
{
char *a[]={"/extsd/sh","/extsd/ss.sh",NULL};
execv("/extsd/sh",a);
}
umountexit:
//===umount and exit
umount("/extsd");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment