Skip to content

Latest commit

 

History

History
executable file
·
40 lines (32 loc) · 1.08 KB

merge.sh

File metadata and controls

executable file
·
40 lines (32 loc) · 1.08 KB
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
if [ "x`id -u`" != "x0" ]; then
echo "not root."
exit 1
fi
set -x
set -e
rm -rf cmake-build
mkdir cmake-build
cd cmake-build
cmake -DCMAKE_BUILD_TYPE=Release ../..
make -j2
gcc -o iself -s -O3 ../iself.c
#time for feh in bin boot etc lib opt sbin usr var ; do find /$feh -type f -exec ./iself {} \; ; done |perl -w -pi -e 's/\A\///;' |grep -v "usr/lib32/" |sort |uniq > ./binaries-64
time for feh in bin boot etc lib opt sbin usr var ; do find /x86/$feh -type f -exec ./iself {} \; ; done |perl -w -pi -e 's/\A\/x86\///;' |grep -v "usr/lib64" |sort |uniq > ./binaries-32
for feh in `cat binaries-32` ; do
Oct 4, 2009
Oct 4, 2009
23
mkdir -p --mode=0755 `dirname "/$feh"`
24
if [ -f "/$feh" ]; then
Oct 4, 2009
Oct 4, 2009
25
26
27
28
29
30
31
FATELF=0
./fatelf-validate "/$feh" && ISFATELF=1
if [ "x$ISFATELF" = "x1" ]; then
./fatelf-replace tmp-fatelf "/$feh" "/x86/$feh"
else
./fatelf-glue tmp-fatelf "/$feh" "/x86/$feh"
fi
32
33
34
35
36
37
38
39
chmod --reference="/$feh" tmp-fatelf
mv tmp-fatelf "/$feh"
else
cp -a "/x86/$feh" "/$feh"
fi
done
# end of merge.sh ...