GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bash-deb-build/deb-build.sh at master · BASH-Auto-Tools/bash-deb-build

Expand file tree

/

deb-build.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
174 lines (156 loc) · 3.82 KB
/

deb-build.sh

Copy path

File metadata and controls

executable file
·
174 lines (156 loc) · 3.82 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/sh
#deb-build.sh
VER="0.6"
DEFPACK="gzip"
tproc=`basename $0`
echo "$tproc version $VER"
echo ""
usage()
{
tproc=`basename $0`
echo "usage:"
echo " fakeroot sh $tproc [options]"
echo " options:"
echo " -c [gzip|bzip2|lzma] - compress method"
echo " -h - this help"
exit 0
}
goodfinish()
{
echo ""
echo "OK.\n"
echo ""
}
testargs()
{
if [ "+$1" = "+--help" -o "x$1" = "x-h" ]
then
usage
fi
}
testcomponent()
{
tnocomp=""
tcomp="whoami"; [ $(which $tcomp) ] || tnocomp="$tnocomp $tcomp"
tcomp="grep"; [ $(which $tcomp) ] || tnocomp="$tnocomp $tcomp"
tcomp="awk"; [ $(which $tcomp) ] || tnocomp="$tnocomp $tcomp"
tcomp="tar"; [ $(which $tcomp) ] || tnocomp="$tnocomp $tcomp"
tcomp="ar"; [ $(which $tcomp) ] || tnocomp="$tnocomp $tcomp"
tcomp="gzip"; [ $(which $tcomp) ] || tnocomp="$tnocomp $tcomp"
tcomp="md5sum"; [ $(which $tcomp) ] || tnocomp="$tnocomp $tcomp"
if [ "x$tnocomp" != "x" ]
then
echo "ERROR: Not found $tnocomp !"
echo ""
exit 1
fi
}
testroot()
{
if [ "$(whoami)" != "root" ]
then
echo "ERROR: You no root!"
echo ""
usage
exit 1
fi
}
main()
{
PACK=$DEFPACK
while getopts ":c:h" opt
do
case $opt in
c) PACK="$OPTARG"
;;
h) usage
;;
*) echo "ERROR: Unknown option -$OPTARG" >&2
exit 1
;;
esac
done
case "$PACK" in
bzip2) PACKOPT="--bzip2"; PACKSUF="tar.bz2"
;;
lzma) PACKOPT="--lzma"; PACKSUF="tar.lzma"
;;
*) PACK="gzip"; PACKOPT="--gzip"; PACKSUF="tar.gz"
;;
esac
echo "Compress: $PACK"
if [ -d "DEBIAN" -a -d "CONTENTS" ]
then
mkdir "root"
cp -r "DEBIAN" "root/DEBIAN"
cp -r "CONTENTS" "root/CONTENTS"
cd "root"
chown -R root *
chgrp -R root *
cd "DEBIAN"
rm -f "md5sums"
packname="$(grep '^Package:' control | awk '{print $2}')"
vername="$(grep '^Version:' control | awk '{print $2}')"
archname="$(grep '^Architecture:' control | awk '{print $2}')"
debname=$packname"_"$vername"_"$archname".deb"
echo "$debname"
cd "../CONTENTS"
echo "Package: $packname"
echo ""
echo "1) Creating checksum..."
for tdir in *
do
if [ -d "$tdir" ]
then
find "$tdir" -type f -printf "\"%p\"\n" | xargs md5sum >> "../DEBIAN/md5sums"
fi
done
cat "../DEBIAN/md5sums"
echo ""
echo "2) Compress contents of the package..."
tar -cvf "../data.tar" ./
echo ""
echo "SUMMARY:"
stat -c "%n : %s" "../data.tar"
echo ""
case "$PACK" in
bzip2) bzip2 -v "../data.tar"
;;
lzma) lzma -v "../data.tar"
;;
*) gzip -v "../data.tar"
;;
esac
echo ""
cd "../DEBIAN"
echo "3) Compress of a package..."
tar -czvf "../control.tar.gz" ./
echo ""
cd ../
echo "4) Creating an index version packing deb package..."
echo "2.0" > "debian-binary"
cat "debian-binary"
echo ""
echo "5) Deb package assembly..."
ar -qS "$debname" "debian-binary" "control.tar.gz" "data.$PACKSUF"
cp "$debname" ../
cd ../
rm -fr root
echo ""
else
if [ ! -d "DEBIAN" ]
then
echo "Not [DEBIAN] packages!"
fi
if [ ! -d "CONTENTS" ]
then
echo "Not [CONTENTS] packages!"
fi
fi
}
testargs "$@"
testcomponent
testroot
main "$@"
goodfinish
#end
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.