| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | shopt -s nullglob |
| 4 | |
| 5 | failscip-shell shell android-platform-external-libselinux 10.0.0+r36-2 fail().() { |
| 6 | echoscip-shell system . . echo. $1 |
| 7 | exit 1 |
| 8 | } |
| 9 | |
| 10 | [scip-shell system . . `[`. `idscip-shell system . . id. -u` = 0 ] || failscip-shell shell android-platform-external-libselinux 10.0.0+r36-2 fail(). "must run as root" |
| 11 | |
| 12 | for d in /usr/share/mcstrans/examples/*; do |
| 13 | echoscip-shell system . . echo. $d |
| 14 | |
| 15 | rmscip-shell system . . rm. -rf /etc/selinux/mls/setrans.conf.bakscip-shell filesystem . . `/etc/selinux/mls/setrans.conf.bak`. /etc/selinux/mls/secolor.conf.bakscip-shell filesystem . . `/etc/selinux/mls/secolor.conf.bak`. /etc/selinux/mls/setrans.d.bakscip-shell filesystem . . `/etc/selinux/mls/setrans.d.bak`. |
| 16 | [scip-shell system . . `[`. $? -eq 0 ] || failscip-shell shell android-platform-external-libselinux 10.0.0+r36-2 fail(). "preclean failed" |
| 17 | |
| 18 | if [scip-shell system . . `[`. -e $d/setrans.conf ]; then |
| 19 | mvscip-shell system . . mv. /etc/selinux/mls/setrans.confscip-shell filesystem . . `/etc/selinux/mls/setrans.conf`. /etc/selinux/mls/setrans.conf.bakscip-shell filesystem . . `/etc/selinux/mls/setrans.conf.bak`. |
| 20 | [scip-shell system . . `[`. $? -eq 0 ] || failscip-shell shell android-platform-external-libselinux 10.0.0+r36-2 fail(). "setrans.conf backup failed" |
| 21 | fi |
| 22 | |
| 23 | if [scip-shell system . . `[`. -e /etc/selinux/mls/secolor.confscip-shell filesystem . . `/etc/selinux/mls/secolor.conf`. ]; then |
| 24 | mvscip-shell system . . mv. /etc/selinux/mls/secolor.confscip-shell filesystem . . `/etc/selinux/mls/secolor.conf`. /etc/selinux/mls/secolor.conf.bakscip-shell filesystem . . `/etc/selinux/mls/secolor.conf.bak`. |
| 25 | [scip-shell system . . `[`. $? -eq 0 ] || failscip-shell shell android-platform-external-libselinux 10.0.0+r36-2 fail(). "secolor.conf backup failed" |
| 26 | fi |
| 27 | |
| 28 | mvscip-shell system . . mv. /etc/selinux/mls/setrans.dscip-shell filesystem . . `/etc/selinux/mls/setrans.d`. /etc/selinux/mls/setrans.d.bakscip-shell filesystem . . `/etc/selinux/mls/setrans.d.bak`. |
| 29 | [scip-shell system . . `[`. $? -eq 0 ] || failscip-shell shell android-platform-external-libselinux 10.0.0+r36-2 fail(). "setrans.d backup failed" |
| 30 | |
| 31 | if [scip-shell system . . `[`. -e $d/setrans.conf ]; then |
| 32 | cpscip-shell system . . cp. -L $d/setrans.conf /etc/selinux/mls/setrans.confscip-shell filesystem . . `/etc/selinux/mls/setrans.conf`. |
| 33 | fi |
| 34 | if [scip-shell system . . `[`. -e $d/secolor.conf ]; then |
| 35 | cpscip-shell system . . cp. -L $d/secolor.conf /etc/selinux/mlsscip-shell filesystem . . `/etc/selinux/mls`. |
| 36 | fi |
| 37 | if [scip-shell system . . `[`. -d $d/setrans.d ]; then |
| 38 | cpscip-shell system . . cp. -Lr $d/setrans.d /etc/selinux/mlsscip-shell filesystem . . `/etc/selinux/mls`. |
| 39 | fi |
| 40 | |
| 41 | runconscip-shell system . . runcon. `catscip-shell system . . cat. /etc/selinux/mls/contexts/initrc_contextscip-shell filesystem . . `/etc/selinux/mls/contexts/initrc_context`.` /etc/init.d/mcstransscip-shell filesystem . . `/etc/init.d/mcstrans`. restart |
| 42 | for t in $d/*.test; do |
| 43 | /usr/share/mcstrans/util/mlstrans-testscip-shell filesystem . . `/usr/share/mcstrans/util/mlstrans-test`. $t |
| 44 | done |
| 45 | for c in $d/*.color; do |
| 46 | /usr/share/mcstrans/util/mlscolor-testscip-shell filesystem . . `/usr/share/mcstrans/util/mlscolor-test`. $c |
| 47 | done |
| 48 | |
| 49 | if [scip-shell system . . `[`. -e /etc/selinux/mls/setrans.conf.bakscip-shell filesystem . . `/etc/selinux/mls/setrans.conf.bak`. ]; then |
| 50 | mvscip-shell system . . mv. /etc/selinux/mls/setrans.conf.bakscip-shell filesystem . . `/etc/selinux/mls/setrans.conf.bak`. /etc/selinux/mls/setrans.confscip-shell filesystem . . `/etc/selinux/mls/setrans.conf`. |
| 51 | fi |
| 52 | if [scip-shell system . . `[`. -e /etc/selinux/mls/secolor.conf.bakscip-shell filesystem . . `/etc/selinux/mls/secolor.conf.bak`. ]; then |
| 53 | mvscip-shell system . . mv. /etc/selinux/mls/secolor.conf.bakscip-shell filesystem . . `/etc/selinux/mls/secolor.conf.bak`. /etc/selinux/mls/secolor.confscip-shell filesystem . . `/etc/selinux/mls/secolor.conf`. |
| 54 | fi |
| 55 | rmscip-shell system . . rm. -rf /etc/selinux/mls/setrans.dscip-shell filesystem . . `/etc/selinux/mls/setrans.d`. |
| 56 | mvscip-shell system . . mv. /etc/selinux/mls/setrans.d.bakscip-shell filesystem . . `/etc/selinux/mls/setrans.d.bak`. /etc/selinux/mls/setrans.dscip-shell filesystem . . `/etc/selinux/mls/setrans.d`. |
| 57 | |
| 58 | restorecon -rv /etc/selinux/mls/setrans.confscip-shell filesystem . . `/etc/selinux/mls/setrans.conf`. /etc/selinux/mls/setrans.dscip-shell filesystem . . `/etc/selinux/mls/setrans.d`. >/dev/nullscip-shell filesystem . . `/dev/null`. |
| 59 | runconscip-shell system . . runcon. `catscip-shell system . . cat. /etc/selinux/mls/contexts/initrc_contextscip-shell filesystem . . `/etc/selinux/mls/contexts/initrc_context`.` /etc/init.d/mcstransscip-shell filesystem . . `/etc/init.d/mcstrans`. restart |
| 60 | done |
| 61 | exit 0 |
| 62 | |
| 63 | |
| 64 |