for Creating deb or rpm package we need to install the following services
- ruby
- gem (auto-installed with ruby)
- fpm
- package_cloud (optional)
- rpm-build ( For rpm package only)
For installing ruby, use this link. after that install fpm and package_cloud
gem install fpm
gem install package_cloud
Use following script for creating package
#!/bin/bash
version=`date +%Y%m%d%H%M`
PACKAGE_DIR=/usr/local/src/installer/install-builder/
POSTINSTALL_MESSAGE_SH_FILE=$PACKAGE_DIR/build/postinst.sh
rm -rf $PACKAGE_DIR/*.deb
rm -rf $PACKAGE_DIR/*.rpm
fpm --after-install $POSTINSTALL_MESSAGE_SH_FILE -s dir -t deb -n installer -v $version -C $PACKAGE_DIR/build/hepic-installer/ -d apt-transport-https -d ca-certificates -d dirmngr -d debconf -d debconf-utils -d libboost-regex-dev -d libmariadb-dev -d libboost-program-options-dev -d libboost-date-time-dev -d libboost-thread-dev -d git -d curl -d wget -d vim -d nano -d sudo -d software-properties-common -d apt-transport-https -d libboost-iostreams-dev -d shc
fpm --after-install $POSTINSTALL_MESSAGE_SH_FILE -s dir -t rpm -n installer -v $version -C $PACKAGE_DIR/build/hepic-installer/ -d git -d curl -d gnupg2 -d boost-regex -d wget -d vim -d nano -d sudo -d shc
mv $PACKAGE_DIR/*.deb $PACKAGE_DIR/installer_$version-amd64.deb
and for pushing the package to the packagecloud use the following script
#!/bin/bash
## PUSH
PACKAGE_DIR==/usr/local/src/installer/install-builder/
RPM_PACKAGE=$PACKAGE_DIR/installer-202211291639-1.x86_64.rpm
DEB_PACKAGE=$PACKAGE_DIR/installer_202211291639-amd64.deb
package_cloud push PACKAGE/repo-dev/el/7 $RPM_PACKAGE
package_cloud push PACKAGE/repo-dev/ol/7 $RPM_PACKAGE
package_cloud push PACKAGE/repo-dev/debian/buster $DEB_PACKAGE
package_cloud push PACKAGE/repo
-dev/debian/stretch $DEB_PACKAGE
Enjoy ;)
No comments:
Post a Comment