Files
Packaging/install.sh
2021-07-12 16:15:59 +02:00

49 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
set -e -x
NAME="server22"
PATH_USR="/tmp/$NAME/usr"
# Deletes server22 dir from /tmp if exists (that was for testing)
sudo rm -rf /tmp/$NAME
# Python installation executed, for debian layout and install it to /tmp/server22
python3 setup.py install --install-layout deb --root /tmp/$NAME
# Remove .egg-info and build dir from root folder
sudo rm -rf ./src/$NAME.egg-info
sudo rm -rf ./build
# Show actual tree of root dir to the user
tree
# Copy /DEBIAN to /tmp/$NAME
sudo cp -R ./DEBIAN /tmp/$NAME
# Deletes __pycache__ from /tmp/$NAME
sudo rm -r $PATH_USR/lib/python3/dist-packages/$NAME/__pycache__
# Creates a dir: /tmp/$NAME/usr/share/doc/$NAME/
mkdir $PATH_USR/share/
mkdir $PATH_USR/share/doc
mkdir $PATH_USR/share/doc/$NAME/
# Add copyright and changelog.gz in created dir (It has to be done for debian packaging)
touch $PATH_USR/share/doc/$NAME/copyright # TODO: make both files in root folder, copy them, and changelog here to .gz
touch $PATH_USR/share/doc/$NAME/changelog.gz
# Change owners
sudo chown -R 0:50 /tmp/$NAME
sudo chown -R 0:0 $PATH_USR/share
# Show actual tree of /tmp/$NAME dir to the user
tree /tmp/$NAME
# dpkg will pack this modified folder to .deb
dpkg -b /tmp/$NAME
# Show lintian output to the user. If there will be some red E, means that installation was not successful
lintian -c /tmp/$NAME.deb
# Rename .deb package (name_of_the_package-version-binary)
dpkg-name -o /tmp/$NAME.deb