-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
1,045 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 zvezdochiot | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Package: bash-deb-build | ||
Version: 0.3 | ||
Architecture: all | ||
Maintainer: zvezdochiot <[email protected]> | ||
Section: utils | ||
Priority: optional | ||
Installed-Size: 36 | ||
Depends: dpkg, grep, tar, gzip, coreutils, binutils | ||
Homepage: http://mykaralw.narod.ru/ | ||
Description: Bash-script for build deb package. | ||
Bash-script for build deb package: | ||
build: | ||
sudo bash-deb-build | ||
unpack: | ||
bash-deb-unpack package.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
#!/bin/bash | ||
#deb-build.sh | ||
|
||
VER="0.3" | ||
GREEN="\033[1;32m" | ||
RED="\033[0;31m" | ||
YELLOW="\033[1;33m" | ||
ENDCOLOR="\033[0m" | ||
|
||
DEFPACK="gzip" | ||
|
||
tproc=`basename $0` | ||
echo -e $GREEN"$tproc version $VER"$ENDCOLOR | ||
echo "" | ||
|
||
usage() | ||
{ | ||
tproc=`basename $0` | ||
echo -e $YELLOW"usage:"$ENDCOLOR | ||
echo -e $GREEN" sudo bash $tproc [gzip|bzip2|lzma]"$ENDCOLOR | ||
exit 0 | ||
} | ||
|
||
goodfinish() | ||
{ | ||
echo "" | ||
echo -e $YELLOW"OK.\n"$ENDCOLOR | ||
echo "" | ||
} | ||
|
||
testargs() | ||
{ | ||
if [ "+$1" != "+" -a "+$1" != "+gzip" -a "+$1" != "+bzip2" -a "+$1" != "+lzma" ] | ||
then | ||
usage | ||
fi | ||
} | ||
|
||
testcomponent() | ||
{ | ||
tnocomp="" | ||
tcomp="/bin/grep" | ||
tdeb="grep_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/awk" | ||
tdeb="gawk_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/bin/tar" | ||
tdeb="tar_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/bin/gzip" | ||
tdeb="gzip_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/md5sum" | ||
tdeb="coreutils_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/ar" | ||
tdeb="binutils_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
if [ "+$tnocomp" != "+" ] | ||
then | ||
echo -e $RED"Not found $tnocomp !"$ENDCOLOR | ||
echo "" | ||
exit 0 | ||
fi | ||
} | ||
|
||
testroot() | ||
{ | ||
if [ $USER != root ] | ||
then | ||
echo -e $RED"You no root!"$ENDCOLOR | ||
echo "" | ||
usage | ||
exit 0 | ||
fi | ||
} | ||
|
||
main() | ||
{ | ||
if [ "+$1" = "+" ] | ||
then | ||
PACK=$DEFPACK | ||
else | ||
PACK="$1" | ||
fi | ||
if [ "$PACK" = "gzip" ] | ||
then | ||
PACKOPT="--gzip" | ||
PACKSUF="tar.gz" | ||
fi | ||
if [ "$PACK" = "bzip2" ] | ||
then | ||
PACKOPT="--bzip2" | ||
PACKSUF="tar.bz2" | ||
fi | ||
if [ "$PACK" = "lzma" ] | ||
then | ||
PACKOPT="--lzma" | ||
PACKSUF="tar.lzma" | ||
fi | ||
if [ -d "config" -a -d "data" ] | ||
then | ||
mkdir "root" | ||
cp -r "config" "root/control" | ||
cp -r "data" "root/data" | ||
cd "root" | ||
chown -R root * | ||
chgrp -R root * | ||
cd "control" | ||
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 "../data" | ||
echo "Package: $packname" | ||
echo "" | ||
|
||
echo "1) Compress contents of the package..." | ||
tar -cvf "../data.tar" ./ | ||
echo "" | ||
echo "SUMMARY:" | ||
stat -c "%n : %s" "../data.tar" | ||
echo "" | ||
if [ "$PACK" = "gzip" ] | ||
then | ||
gzip -v "../data.tar" | ||
fi | ||
if [ "$PACK" = "bzip2" ] | ||
then | ||
bzip2 -v "../data.tar" | ||
fi | ||
if [ "$PACK" = "lzma" ] | ||
then | ||
lzma -v "../data.tar" | ||
fi | ||
echo "" | ||
|
||
echo "2) Creating checksum..." | ||
for tdir in * | ||
do | ||
if [ -d "$tdir" ] | ||
then | ||
find "$tdir" -type f -printf "\"%p\"\n" | xargs md5sum >> "../md5sums" | ||
fi | ||
done | ||
cat "../md5sums" | ||
echo "" | ||
|
||
cd ../ | ||
mv -f "md5sums" "control" | ||
|
||
cd control | ||
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 "config" ] | ||
then | ||
echo "Not [config] packages!" | ||
fi | ||
if [ ! -d "data" ] | ||
then | ||
echo "Not [data] packages!" | ||
fi | ||
fi | ||
} | ||
|
||
testargs "$@" | ||
testcomponent | ||
testroot | ||
main "$@" | ||
goodfinish | ||
|
||
#end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/bin/bash | ||
#deb-unpack.sh | ||
|
||
VER="0.3" | ||
GREEN="\033[1;32m" | ||
RED="\033[0;31m" | ||
YELLOW="\033[1;33m" | ||
ENDCOLOR="\033[0m" | ||
|
||
tproc=`basename $0` | ||
echo -e $GREEN"$tproc version $VER"$ENDCOLOR | ||
echo "" | ||
|
||
usage() | ||
{ | ||
tproc=`basename $0` | ||
echo -e $YELLOW"usage:"$ENDCOLOR | ||
echo -e $GREEN" bash $tproc packet.deb"$ENDCOLOR | ||
exit 0 | ||
} | ||
|
||
goodfinish() | ||
{ | ||
echo "" | ||
echo -e $YELLOW"OK.\n"$ENDCOLOR | ||
echo "" | ||
} | ||
|
||
testargs() | ||
{ | ||
if [ "+$1" = "+" -o "+$1" = "+--help" -o "+$1" = "+-h" ] | ||
then | ||
usage | ||
fi | ||
} | ||
|
||
testcomponent() | ||
{ | ||
tnocomp="" | ||
tcomp="/bin/grep" | ||
tdeb="grep_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/awk" | ||
tdeb="base_CD1" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/bin/tar" | ||
tdeb="tar_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/bin/gzip" | ||
tdeb="gzip_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/md5sum" | ||
tdeb="coreutils_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/ar" | ||
tdeb="binutils_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
if [ "+$tnocomp" != "+" ] | ||
then | ||
echo -e $RED"Not found $tnocomp !"$ENDCOLOR | ||
echo "" | ||
exit 0 | ||
fi | ||
} | ||
|
||
testroot() | ||
{ | ||
if [ $USER != root ] | ||
then | ||
echo -e $RED"You no root!"$ENDCOLOR | ||
echo "" | ||
usage | ||
exit 0 | ||
fi | ||
} | ||
|
||
main() | ||
{ | ||
tdeb="$1" | ||
if [ -f "$tdeb" ] | ||
then | ||
echo "Unpack $tdeb..." | ||
mkdir -p "config" | ||
mkdir -p "data" | ||
echo " config..." | ||
dpkg -e "$tdeb" "./config" | ||
echo " data..." | ||
dpkg -x "$tdeb" "./data" | ||
echo "OK." | ||
fi | ||
} | ||
|
||
testargs "$@" | ||
testcomponent | ||
#testroot | ||
main "$@" | ||
goodfinish | ||
|
||
#end | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Package: bash-deb-build | ||
Version: 0.3 | ||
Architecture: all | ||
Maintainer: zvezdochiot <[email protected]> | ||
Section: utils | ||
Priority: optional | ||
Installed-Size: 36 | ||
Depends: dpkg, grep, tar, gzip, coreutils, binutils | ||
Homepage: http://mykaralw.narod.ru/ | ||
Description: Bash-script for build deb package. | ||
Bash-script for build deb package: | ||
build: | ||
sudo bash-deb-build | ||
unpack: | ||
bash-deb-unpack package.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
67acb21ed5eaf746338e545776ea3e62 usr/share/scripts/bash/deb-unpack.sh | ||
5a2d6eec06ddea876015418902d5e079 usr/share/scripts/bash/deb-build.sh | ||
9386fb1465342ba9b7660b72ea6dafda usr/share/resources/bash-deb-build/example.tar.gz |
Oops, something went wrong.