forked from puppylinux-woof-CE/woof-CE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vcs-workarounds
executable file
·128 lines (118 loc) · 4.16 KB
/
vcs-workarounds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
#BK nov. 2011
[ ! -d woof-code ] && exit
echo
echo "You don't need to run this script.
I ran it once, which should be enough. It applies workarounds for a VCS to the
'woof-code' directory -- see more explanation in 'merge-arch_code_distro-2-out'
script."
echo -n "Press 'c' key to continue, ENTER key only to quit: "
read goforit
[ "$goforit" != "c" ] && exit
echo
echo "Creating file 'EMPTYDIRMARKER' in empty directories..."
for ONEDIR in `find woof-code -type d`
do
[ ! -d $ONEDIR ] && continue #catch dirs with spaces.
if [ "`ls $ONEDIR`" = "" ];then
echo " $ONEDIR/EMPTYDIRMARKER"
touch $ONEDIR/EMPTYDIRMARKER
fi
done
echo
echo "Rename [ and [[ files as LEFTSQBRACKETCHAR and DBLLEFTSQBRACKETCHAR..."
for ONEBAD in `find woof-code -name \\[`
do
ONEDIR="`dirname "$ONEBAD"`"
[ ! -e ${ONEDIR}/[ ] && continue #catch dirs with spaces
echo " renaming ${ONEDIR}/[ to ${ONEDIR}/LEFTSQBRACKETCHAR"
mv -f ${ONEDIR}/[ ${ONEDIR}/LEFTSQBRACKETCHAR
done
for ONEBAD in `find woof-code -name \\[\\[`
do
ONEDIR="`dirname "$ONEBAD"`"
[ ! -e ${ONEDIR}/[[ ] && continue #catch dirs with spaces
echo " renaming ${ONEDIR}/[[ to ${ONEDIR}/DBLLEFTSQBRACKETCHAR"
mv -f ${ONEDIR}/[[ ${ONEDIR}/DBLLEFTSQBRACKETCHAR
done
echo
echo "Convert 'dev' directories to DEVDIR.tar.gz tarballs..."
if [ -d woof-code/rootfs-skeleton/dev ];then
echo " woof-code/rootfs-skeleton/dev"
cd woof-code/rootfs-skeleton
tar -c -f DEVDIR.tar dev/
gzip DEVDIR.tar
mv -f DEVDIR.tar.gz ../../woof-arch/woof-code_rootfs-skeleton_DEVDIR.tar.gz
echo -n 'woof-code_rootfs-skeleton_DEVDIR.tar.gz' > DEVDIRMARKER
rm -rf dev
cd ../../
fi
if [ -d woof-code/boot/initrd-tree0/dev ];then
echo " woof-code/boot/initrd-tree0/dev"
cd woof-code/boot/initrd-tree0
tar -c -f DEVDIR.tar dev/
gzip DEVDIR.tar
mv -f DEVDIR.tar.gz ../../../woof-arch/woof-code_boot_initrd-tree0_DEVDIR.tar.gz
echo -n 'woof-code_boot_initrd-tree0_DEVDIR.tar.gz' > DEVDIRMARKER
rm -rf dev
cd ../../../
fi
#echo "Move all image files from woof-code to woof-arch..."
#rm -rf /tmp/vcs-workarounds 2>/dev/null
#mkdir /tmp/vcs-workarounds
#if [ -f woof-arch/woof-code-binary-images.tar.gz ];then #from previous time ran this script.
# cd woof-arch
# tar -zxf woof-code-binary-images.tar.gz
# cp -a -f woof-code-binary-images/* /tmp/vcs-workarounds/
# rm -rf woof-code-binary-images
# rm -f woof-code-binary-images.tar.gz
# cd ..
#fi
#for ONEFILE in `find woof-code -type f -iname '*.gif' -or -iname '*.png' -or -iname '*.jpg' -or -iname '*.jpeg' | sed -e 's% %SPACECHAR%g' | tr '\n' ' '`
#do
# ONEFILE="`echo -n "$ONEFILE" | sed -e 's%SPACECHAR% %g'`"
# [ ! -e "$ONEFILE" ] && continue
# ONENAME="`basename "$ONEFILE"`"
# ONEPATH="`dirname "$ONEFILE"`"
# echo "$ONEFILE" > ${ONEFILE}MARKER
# mkdir -p "/tmp/vcs-workarounds/${ONEPATH}"
# mv -f "$ONEFILE" "/tmp/vcs-workarounds/${ONEFILE}"
#done
#mv -f /tmp/vcs-workarounds woof-arch/woof-code-binary-images
#cd woof-arch
#dir2tgz woof-code-binary-images
#cd ..
#sync
echo
echo "Record special permissions/ownership in woof-code/VCSMETADATA..."
#catch-22 situation, can only do this on the original 'woof-code', not a 'woof-code'
#that is created from a VCS checkout. Assume such a checkout will also contain file
#'VCSMETADATA'...
if [ ! -f woof-code/VCSMETADATA ];then
cd woof-code
touch VCSMETADATA
for ONESPEC in `find rootfs-skeleton -mindepth 1 | tr '\n' ' '`
do
[ ! -e $ONESPEC ] && continue
FSTATS="`stat --format=%a:%U:%G $ONESPEC`"
[ "$FSTATS" != "755:root:root" ] && [ "$FSTATS" != "644:root:root" ] && echo "${ONESPEC}:${FSTATS}" >> VCSMETADATA
done
for ONESPEC in `find packages-templates -mindepth 1 | tr '\n' ' '`
do
[ ! -e $ONESPEC ] && continue
FSTATS="`stat --format=%a:%U:%G $ONESPEC`"
[ "$FSTATS" != "755:root:root" ] && [ "$FSTATS" != "644:root:root" ] && echo "${ONESPEC}:${FSTATS}" >> VCSMETADATA
done
sort -u --key=1,1 --field-separator=: VCSMETADATA > /tmp/fossil-VCSMETADATA
mv -f /tmp/fossil-VCSMETADATA VCSMETADATA
if [ -s VCSMETADATA ];then
echo "Written to VCSMATADATA:"
cat VCSMETADATA
fi
cd ..
else
echo "NOTE: woof-code/VCSMETADATA already exists. This can only be edited manually
if you want to add or modify any file/dir permissions/ownerhsip."
fi
echo "Finished"
###END###