Skip to content

Instantly share code, notes, and snippets.

@imnuts
Last active October 13, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imnuts/4236965 to your computer and use it in GitHub Desktop.
Save imnuts/4236965 to your computer and use it in GitHub Desktop.
Script to set permissions on /system for the VZW Galaxy Note 2. Useful when building ROMs that are to be packaged into a system.img.
#!/bin/bash
chown -R 0:0 system/*
find system/ -type f -print0 | xargs -0 chmod 0644
find system/ -type d -print0 | xargs -0 chmod 0755
chown 0:0 system/build.prop
chmod 0644 system/build.prop
chown -R 0:2000 system/bin/*
find system/bin/ -type f -print0 | xargs -0 chmod 0755
find system/bin/ -type d -print0 | xargs -0 chmod 0755
chown 0:3003 system/bin/netcfg
chmod 02750 system/bin/netcfg
chown 0:3004 system/bin/ping
chmod 02755 system/bin/ping
chown 0:2000 system/bin/run-as
chmod 06750 system/bin/run-as
chown -R 1002:1002 system/etc/bluetooth/
find system/etc/bluetooth/ -type f -print0 | xargs -0 chmod 0440
find system/etc/bluetooth/ -type d -print0 | xargs -0 chmod 0755
chown 0:0 system/etc/bluetooth
chmod 0755 system/etc/bluetooth
chown 1000:1000 system/etc/bluetooth/auto_pairing.conf
chmod 0640 system/etc/bluetooth/auto_pairing.conf
chown 3002:3002 system/etc/bluetooth/blacklist.conf
chmod 0444 system/etc/bluetooth/blacklist.conf
chown 1002:1002 system/etc/dbus.conf
chmod 0440 system/etc/dbus.conf
chown 1014:2000 system/etc/dhcpcd/dhcpcd-run-hooks
chmod 0550 system/etc/dhcpcd/dhcpcd-run-hooks
chown 0:2000 system/etc/init.goldfish.sh
chmod 0550 system/etc/init.goldfish.sh
chown -R 0:0 system/etc/ppp
find system/etc/ppp -type f -print0 | xargs -0 chmod 0555
find system/etc/ppp -type d -print0 | xargs -0 chmod 0755
chown -R 0:2000 system/vendor
find system/vendor -type f -print0 | xargs -0 chmod 0644
find system/vendor -type d -print0 | xargs -0 chmod 0755
chown -R 0:0 system/vendor/firmware
find system/vendor/firmware -type d -print0 | xargs -0 chmod 0755
find system/vendor/firmware -type f -print0 | xargs -0 chmod 0644
chown 0:2000 system/vendor/etc
chmod 0755 system/vendor/etc
chown 0:2000 system/vendor/etc/nxp
chmod 0755 system/vendor/etc/nxp
chown 0:2000 system/vendor/etc/nxp/BargeIn
chmod 0755 system/vendor/etc/nxp/BargeIn
chown 0:2000 system/vendor/etc/nxp/mVoIP
chmod 0755 system/vendor/etc/nxp/mVoIP
chown 0:2000 system/vendor/etc/nxp/mVoIPSec
chmod 0755 system/vendor/etc/nxp/mVoIPSec
chown 0:2000 system/vendor/firmware
chmod 0755 system/vendor/firmware
chown 0:2000 system/vendor/lib
chmod 0755 system/vendor/lib
chown -R 0:2000 system/vendor/lib/drm
find system/vendor/lib/drm -type f -print0 | xargs -0 chmod 0644
find system/vendor/lib/drm -type d -print0 | xargs -0 chmod 0755
chown 0:0 system/vendor/lib/drm/libdrmwvmplugin.so
chmod 0644 system/vendor/lib/drm/libdrmwvmplugin.so
chown -R 0:2000 system/vendor/pittpatt
find system/vendor/pittpatt -type f -print0 | xargs -0 chmod 0644
find system/vendor/pittpatt -type d -print0 | xargs -0 chmod 0755
chown 0:0 system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7/left_eye-y0-yi45-p0-pi45-r0-ri20.lg_32/full_model.bin
chmod 0644 system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7/left_eye-y0-yi45-p0-pi45-r0-ri20.lg_32/full_model.bin
chown 0:0 system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7/nose_base-y0-yi45-p0-pi45-r0-ri20.lg_32/full_model.bin
chmod 0644 system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7/nose_base-y0-yi45-p0-pi45-r0-ri20.lg_32/full_model.bin
chown 0:0 system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7/right_eye-y0-yi45-p0-pi45-r0-ri20.lg_32-2/full_model.bin
chmod 0644 system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7/right_eye-y0-yi45-p0-pi45-r0-ri20.lg_32-2/full_model.bin
chown 0:0 system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6/head-y0-yi45-p0-pi45-r0-ri30.4a-v24/full_model.bin
chmod 0644 system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6/head-y0-yi45-p0-pi45-r0-ri30.4a-v24/full_model.bin
chown 0:0 system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6/head-y0-yi45-p0-pi45-rn30-ri30.5-v24/full_model.bin
chmod 0644 system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6/head-y0-yi45-p0-pi45-rn30-ri30.5-v24/full_model.bin
chown 0:0 system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6/head-y0-yi45-p0-pi45-rp30-ri30.5-v24/full_model.bin
chmod 0644 system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6/head-y0-yi45-p0-pi45-rp30-ri30.5-v24/full_model.bin
chown 0:0 system/vendor/pittpatt/models/recognition/face.face.y0-y0-22-b-N/full_model.bin
chmod 0644 system/vendor/pittpatt/models/recognition/face.face.y0-y0-22-b-N/full_model.bin
chown 0:2000 system/xbin
find system/xbin -type d -print0 | xargs -0 chmod 0755
find system/xbin -type f -print0 | xargs -0 chmod 0755
if [ -f system/bin/su ]; then
chown 0:0 system/bin/su
chmod 06755 system/bin/su
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment