Skip to content

Small command-line app for changing ext fs family file 'immutable' attribute

License

Notifications You must be signed in to change notification settings

duangsuse-valid-projects/attrtools

Repository files navigation

attrtools

Small command-line app for reading 'i/a' attribute and changing file 'immutable' attribute

Usage

Attrtools Usage:
  ./attrtools +i <path> ; Set Immutable
  ./attrtools -i <path> ; Unset Immutable
  ./attrtools <path> ; Is Immutable?
  • attrtools +i <path> to add 'immutable' flag for file
  • attrtools -i <path> to remove 'immutable' flag for file
  • attrtools <path> to query file flags

Examples

sudo ./attrtools +i libe2.o

File: libe2.o

./attrtools libe2.o

File: libe2.o
16
+i
+a

sudo ./attrtools -i libe2.o

File: libe2.o

sudo ./attrtools +i libe2

Cannot stat: libe2: No such file or directory

./attrtools -i libe2.o

File: libe2.o
Failed to chattr -i: Operation not permitted

Exit code

Exit 1 if command line/file stat fails

Exit 2 if chattr/lsattr fails

stdout or stderr

  • "informations" are printed to stdout
  • "results" are printed to stderr
  • "errors" are printed to stderr

NDK Compiling

Execute this in project dir:

ndk-build NDK_PROJECT_PATH=`pwd` NDK_APPLICATION_MK=./Application.mk

Android front-end

https://github.com/duangsuse/ChangeAttr