[Android Q&A, Help & Troubleshooting] ZeeX:
This is my third time asking here around the forums and I hope someone will answer ASAP.

The updater-script file below doesn't seem to work properly every-time i try to flash it, it gives me a status 7 error message and tells me the error is at setting permissions. Can someone please take a look at setting permissions and tell me what's the problem there. Thanks in advance.

ui_print("Flashing nDroid ...");

unmount("/system");
ui_print("-> Mounting System");
run_program("/sbin/mount", "-t", "auto", "/system");
ui_print("-> Mounting Data");
run_program("/sbin/mount", "-t", "auto", "/data");
ui_print("-> Mounting Cache");
run_program("/sbin/mount", "-t", "auto", "/cache");

ui_print("-> Wiping System");
delete_recursive("/system");
ui_print("-> Wiping Cache");
delete_recursive("/cache");

ui_print("-> Extracting System");
package_extract_dir("system", "/system");

ui_print("-> Symlinking");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("mksh", "/system/bin/sh");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("toolbox", "/system/bin/chcon");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/clear");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/cp");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/du");
symlink("toolbox", "/system/bin/getenforce");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/getsebool");
symlink("toolbox", "/system/bin/grep");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/load_policy");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/md5");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/restorecon");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/runcon");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/setenforce");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/setsebool");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/wipe");

ui_print("-> Setting Permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 0, 0755, 0644, "/system/bin");
set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d");
set_perm(0, 0, 0, 0755, "/system/etc/init.d");
set_perm_recursive(0, 0, 0755, 0644, "/system/etc/init.d");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/init.d");
set_perm_recursive(0, 0, 0755, 0644, "/system/lib");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 2000, 0755, "/system/bin/app_process");
set_perm(0, 2000, 0755, "/system/bin/bintvoutservice");
set_perm(0, 2000, 0755, "/system/bin/bootanimation");
set_perm(0, 2000, 0755, "/system/bin/bugreport");
set_perm(0, 2000, 0755, "/system/bin/clatd");
set_perm(0, 2000, 0755, "/system/bin/connfwexe");
set_perm(0, 2000, 0755, "/system/bin/createsystemfile");
set_perm(0, 2000, 0755, "/system/bin/debuggerd");
set_perm(0, 2000, 0755, "/system/bin/dnsmasq");
set_perm(0, 2000, 0755, "/system/bin/drmserver");
set_perm(0, 2000, 0755, "/system/bin/dumpstate");
set_perm(0, 2000, 0755, "/system/bin/dumpsys");
set_perm(0, 2000, 0755, "/system/bin/hostapd");
set_perm(0, 2000, 0755, "/system/bin/icd");
set_perm(0, 2000, 0755, "/system/bin/immvibed");
set_perm(0, 2000, 0755, "/system/bin/installd");
set_perm(0, 2000, 0755, "/system/bin/insthk");
set_perm(0, 2000, 0755, "/system/bin/ipruleset");
set_perm(0, 2000, 0755, "/system/bin/keystore");
set_perm(0, 2000, 0755, "/system/bin/logwrapper");
set_perm(0, 2000, 0755, "/system/bin/mcDriverDaemon");
set_perm(0, 2000, 0755, "/system/bin/mdnsd");
set_perm(0, 2000, 0755, "/system/bin/mediaserver");
set_perm(0, 2000, 0755, "/system/bin/mksh");
set_perm(0, 2000, 0755, "/system/bin/mtpd");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 2000, 0755, "/system/bin/netd");
set_perm(0, 2000, 0755, "/system/bin/npsmobex");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 0755, "/system/bin/pppd");
set_perm(0, 2000, 0755, "/system/bin/prepare_param.sh");
set_perm(0, 2000, 0755, "/system/bin/racoon");
set_perm(0, 2000, 0755, "/system/bin/rild");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm(0, 2000, 0755, "/system/bin/samsungpowersoundplay");
set_perm(0, 2000, 0755, "/system/bin/scranton_RD");
set_perm(0, 2000, 0755, "/system/bin/sdcard");
set_perm(0, 2000, 0755, "/system/bin/secure_storage_daemon");
set_perm(0, 2000, 0755, "/system/bin/servicemanager");
set_perm(0, 2000, 0755, "/system/bin/smdexe");
set_perm(0, 2000, 0755, "/system/bin/surfaceflinger");
set_perm(0, 2000, 0755, "/system/bin/vold");
set_perm(0, 2000, 0755, "/system/bin/wpa_supplicant");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/etc");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/BargeIn");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/mVoIP");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/mVoIPFMC");
set_perm(0, 2000, 0755, "/system/vendor/etc/nxp/mVoIPSec");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm(0, 2000, 0755, "/system/vendor/lib/drm");
set_perm(0, 2000, 0755, "/system/vendor/lib/hw");
set_perm(0, 2000, 0755, "/system/vendor/lib/mediadrm");
set_perm(0, 2000, 0755, "/system/vendor/media");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models/detection");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models/recognition");
set_perm(0, 2000, 06755, "/system/xbin/debuggerd");

set_perm(0, 0, 06755, "/system/xbin/su");
set_perm(0, 0, 06755, "/system/xbin/daemonsu");
run_program("/system/xbin/su", "--install");
set_perm(0, 0, 06755, "/system/bin/.ext/.su");

symlink("/system/xbin/busybox", "/system/bin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");

ui_print("-> Flashing Kernel");
package_extract_file("boot.img", "/dev/block/mmcblk0p5");

ui_print("Installation Complete");
set_progress(1.0);