Skip to content

Commit a504382

Browse files
committed
target: move my specifics to preset
1 parent 7837efb commit a504382

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

presets/ghost/check.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
set -e
44
source ./.config.sh || exit 1
55

6+
# Replace some /bin programs
7+
pushd "$TARGET/bin/"
8+
ln -sf busybox login # bypass logind
9+
[ -x mcedit ] && ln -s mcedit vi 2> /dev/null || true
10+
[ -f bash ] && ln -sf bash sh || true
11+
rm -f init*
12+
popd
13+
14+
# Add other read permission for text executable files inside bin
15+
chmod -R o-r "$TARGET/usr/bin/" 2> /dev/null || true
16+
for bin in $(find "$TARGET/usr/bin/" -type f -exec file {} \; | grep 'text executable' | grep -E -i -o -e "$TARGET/usr/bin/[-a-z0-9._+]+: " | sed 's/: //'); do
17+
chmod o+r "$bin"
18+
done
19+
chmod o+rx "$TARGET/usr/bin/busybox"
20+
[ -f "$TARGET/bin/su" ] && [ ! -L "$TARGET/bin/su" ] && chmod u+s "$TARGET/bin/su" || true
21+
22+
623
echo -n "Checking $TARGET files permissions...."
724

825
# SUID and GUID

scripts/build_target.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,10 @@ chmod 0760 "$TARGET/init"
1010
mkdir -p "$TARGET/usr/src"
1111
git rev-parse HEAD > "$TARGET/usr/src/niceOS.hash"
1212

13-
# Replace some /bin programs
13+
# Provide some /bin programs
1414
pushd "$TARGET/bin/"
15-
# Overwrite some core utils
16-
ln -s busybox clear &> /dev/null || true # everybody likes clear
17-
ln -sf busybox login # bypass logind
15+
ln -s busybox clear &> /dev/null || true # everybody wants clear
1816
ln -sf busybox hostname # override net-tools version or /proc/sys/kernel/hostname symlink for more universal solution
19-
20-
[ -x mcedit ] && { # mcedit if no vi
21-
ln -s mcedit vi 2> /dev/null || true
22-
}
23-
[ -f bash ] && { # bash pls
24-
ln -sf bash sh
25-
}
26-
rm -f init # we have own init
2717
popd
2818

2919

@@ -32,15 +22,7 @@ chmod -R o+rX,o-w "$TARGET/etc/"
3222
chmod -R o-r "$TARGET/etc/ssh/" 2> /dev/null || true
3323
chmod -R o+rX "$TARGET/usr/share/" 2> /dev/null || true
3424
chmod -R o-rwx "$TARGET/root/"
35-
36-
37-
# Add other read permission for text executable files inside bin
38-
chmod -R o-r "$TARGET/usr/bin/" 2> /dev/null || true
39-
for bin in $(find "$TARGET/usr/bin/" -type f -exec file {} \; | grep 'text executable' | grep -E -i -o -e "$TARGET/usr/bin/[-a-z0-9._+]+: " | sed 's/: //'); do
40-
chmod o+r "$bin"
41-
done
4225
chmod o+rx "$TARGET/usr/bin/busybox"
43-
[ -f "$TARGET/bin/su" ] && [ ! -L "$TARGET/bin/su" ] && chmod u+s "$TARGET/bin/su" || true
4426

4527

4628
# Replace some $TARGET/usr files with our own build support

0 commit comments

Comments
 (0)