unliberios.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // unliberios.c
  3. // electra
  4. //
  5. // Created by CoolStar on 2/12/18.
  6. // Copyright © 2018 Electra Team. All rights reserved.
  7. //
  8. #include "unliberios.h"
  9. #include "file_utils.h"
  10. #include <unistd.h>
  11. #include <spawn.h>
  12. #include <sys/wait.h>
  13. bool checkLiberiOS(){
  14. if (file_exists_electra("/jb"))
  15. return true;
  16. if (file_exists_electra("/bin/zsh"))
  17. return true;
  18. if (file_exists_electra("/etc/motd"))
  19. return true;
  20. return false;
  21. }
  22. void removeLiberiOS(){
  23. //From removeMe.sh
  24. printf("Removing liberiOS...");
  25. int rv;
  26. pid_t pd;
  27. unlink("/etc/motd");
  28. unlink("/.cydia_no_stash");
  29. rv = posix_spawn(&pd, "/electra/rm", NULL, NULL, (char **)&(const char*[]){ "rm", "-rf", "/Applications/Cydia.app", NULL }, NULL);
  30. waitpid(pd, NULL, 0);
  31. rv = posix_spawn(&pd, "/electra/rm", NULL, NULL, (char **)&(const char*[]){ "rm", "-rf", "/usr/share/terminfo", NULL }, NULL);
  32. waitpid(pd, NULL, 0);
  33. rv = posix_spawn(&pd, "/electra/rm", NULL, NULL, (char **)&(const char*[]){ "rm", "-rf", "/usr/local/bin", NULL }, NULL);
  34. waitpid(pd, NULL, 0);
  35. rv = posix_spawn(&pd, "/electra/rm", NULL, NULL, (char **)&(const char*[]){ "rm", "-rf", "/usr/local/lib", NULL }, NULL);
  36. waitpid(pd, NULL, 0);
  37. unlink("/bin/zsh");
  38. unlink("/etc/profile");
  39. unlink("/etc/zshrc");
  40. unlink("/usr/bin/scp"); //missing from removeMe.sh oddly
  41. rv = posix_spawn(&pd, "/electra/rm", NULL, NULL, (char **)&(const char*[]){ "rm", "-rf", "/jb", NULL }, NULL);
  42. waitpid(pd, NULL, 0);
  43. }