#!/bin/bash
# script name: rebuild-deb.sh
# extracts/rebuilds a deb package
# Put your deb and the script in a new directory and run it from there
#
echo "This script extracts and rebuilds a deb package. "
echo "It should called from the directory containing the original deb and run as:"
echo "./rebuild-deb.sh"
echo
ls
echo
echo "1. Extract deb?"
echo "2. Make deb?"
echo "Enter <1/2> :"
read REPLY
echo
if [ "$REPLY" = "1" ]; then
ls
DEB=$(ls *.deb 2>&1)
mkdir package
cd ./package
ar -x ../$DEB
rm debian-binary
tar xvzf data.tar.gz && rm data.tar.gz
mkdir DEBIAN && cd DEBIAN
tar xvzf ../control.tar.gz && rm ../control.tar.gz
echo "Extracted to './package'"
echo "Make your changes. Make sure to update control and md5sum files"
elif [ "$REPLY" = "2" ]; then
PACKAGE=$(cat 'package/DEBIAN/control'|grep Package|sed 's|Package: ||')
VERSION=$(cat 'package/DEBIAN/control'|grep Version|sed 's|Version: ||')
ARCH=$(cat 'package/DEBIAN/control'|grep Architecture|sed 's|Architecture: ||')
fakeroot dpkg-deb -b package $PACKAGE\_$VERSION\_$ARCH.deb
echo "Done"
fi
# script name: rebuild-deb.sh
# extracts/rebuilds a deb package
# Put your deb and the script in a new directory and run it from there
#
echo "This script extracts and rebuilds a deb package. "
echo "It should called from the directory containing the original deb and run as:"
echo "./rebuild-deb.sh"
echo
ls
echo
echo "1. Extract deb?"
echo "2. Make deb?"
echo "Enter <1/2> :"
read REPLY
echo
if [ "$REPLY" = "1" ]; then
ls
DEB=$(ls *.deb 2>&1)
mkdir package
cd ./package
ar -x ../$DEB
rm debian-binary
tar xvzf data.tar.gz && rm data.tar.gz
mkdir DEBIAN && cd DEBIAN
tar xvzf ../control.tar.gz && rm ../control.tar.gz
echo "Extracted to './package'"
echo "Make your changes. Make sure to update control and md5sum files"
elif [ "$REPLY" = "2" ]; then
PACKAGE=$(cat 'package/DEBIAN/control'|grep Package|sed 's|Package: ||')
VERSION=$(cat 'package/DEBIAN/control'|grep Version|sed 's|Version: ||')
ARCH=$(cat 'package/DEBIAN/control'|grep Architecture|sed 's|Architecture: ||')
fakeroot dpkg-deb -b package $PACKAGE\_$VERSION\_$ARCH.deb
echo "Done"
fi
No comments:
Post a Comment