Skip to content

Commit feb6675

Browse files
author
CharmySoft
committed
Create a bash script to build a Debian package
1 parent 0adaba2 commit feb6675

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

build-deb.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
VERSION='1.0'
4+
PACKAGE_REVISION='1'
5+
# Make a temperary directory for the debian package
6+
mkdir tic-tac-toe-online_${VERSION}-${PACKAGE_REVISION}
7+
chmod 0755 tic-tac-toe-online_${VERSION}-${PACKAGE_REVISION}
8+
cd tic-tac-toe-online_${VERSION}-${PACKAGE_REVISION}
9+
10+
# Create the DEBIAN/control file
11+
mkdir DEBIAN
12+
cat >> DEBIAN/control << EOM
13+
Package: tic-tac-toe-online
14+
Version: ${VERSION}-${PACKAGE_REVISION}
15+
Section: games
16+
Installed-Size: 226
17+
Maintainer: Charlie Chen <Charlie@CharmySoft.com>
18+
Homepage: http://www.CharmySoft.com/app/ttt-python.htm
19+
Priority: optional
20+
Architecture: all
21+
Depends: python3
22+
Description: Tic-Tac-Toe Online
23+
Simple yet fun noughts and crosses game online
24+
25+
EOM
26+
27+
# Create 'usr' folder
28+
mkdir usr
29+
# Create 'usr/bin/tic-tac-toe-online' script
30+
mkdir usr/bin
31+
cat >> usr/bin/tic-tac-toe-online << EOM
32+
#!/bin/bash
33+
/usr/share/tic-tac-toe-online/ttt_client_gui.py
34+
EOM
35+
# Add execution permission
36+
chmod 0755 usr/bin/tic-tac-toe-online
37+
# Create 'usr/share' folder
38+
mkdir usr/share
39+
# Create a menu entry
40+
mkdir usr/share/applications
41+
cat >> usr/share/applications/tic-toc-toe-online.desktop << EOM
42+
[Desktop Entry]
43+
Name=Tic-Tac-Toe Online
44+
Version=${VERSION}
45+
Exec=tic-tac-toe-online
46+
Comment=Simple yet fun noughts and crosses game online
47+
Icon=/usr/share/pixmaps/tic-tac-toe-online.png
48+
Type=Application
49+
Terminal=false
50+
StartupNotify=true
51+
Categories=Games;
52+
EOM
53+
# Add execution permission
54+
chmod 0644 usr/share/applications/tic-toc-toe-online.desktop
55+
# Copy the application icon
56+
mkdir usr/share/pixmaps
57+
cp ../icons/icon.png usr/share/pixmaps/tic-tac-toe-online.png
58+
# Copy all the required files to 'usr/share/tic-tac-toe-online'
59+
mkdir usr/share/tic-tac-toe-online
60+
cp ../ttt_client.py usr/share/tic-tac-toe-online
61+
cp ../ttt_client_gui.py usr/share/tic-tac-toe-online
62+
cp ../res -r usr/share/tic-tac-toe-online/res
63+
# Add execution permission
64+
chmod 0755 usr/share/tic-tac-toe-online/ttt_client.py
65+
chmod 0755 usr/share/tic-tac-toe-online/ttt_client_gui.py
66+
# Build the debian package
67+
cd ..
68+
chown -R root tic-tac-toe-online_${VERSION}-${PACKAGE_REVISION}
69+
dpkg-deb --build tic-tac-toe-online_${VERSION}-${PACKAGE_REVISION}
70+
71+
# Remove the temperary folder
72+
rm -r tic-tac-toe-online_${VERSION}-${PACKAGE_REVISION}

0 commit comments

Comments
 (0)