Skip to content

Commit 88e1554

Browse files
committed
sexy code
1 parent 952917b commit 88e1554

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.3
1+
1.2.3

generate-mod.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
#
18+
# shellcheck disable=SC2001
1819
PKG_PRETTY_NAME="Emulationstation: PSX Playlist"
1920
PKG_NAME="es-psx-playlist"
2021

@@ -29,41 +30,42 @@ POSTINST="${PKG_TARGET}/DEBIAN/postinst"
2930
POSTRM="${PKG_TARGET}/DEBIAN/postrm"
3031
CONTROL="${PKG_TARGET}/DEBIAN/control"
3132

32-
VERSION=$([ -f VERSION ] && head VERSION || echo "0.0.1")
33+
VERSION="$([ -f VERSION ] && head VERSION || echo "0.0.1")"
3334

3435
LAST_TAG_COMMIT=$(git rev-list --tags --max-count=1)
35-
LAST_TAG=$(git describe --tags ${LAST_TAG_COMMIT})
36+
LAST_TAG=$(git describe --tags "${LAST_TAG_COMMIT}")
3637

37-
MAJOR=$(echo ${VERSION} | sed "s/^\([0-9]*\).*/\1/")
38-
MINOR=$(echo ${VERSION} | sed "s/[0-9]*\.\([0-9]*\).*/\1/")
39-
PATCH=$(echo ${VERSION} | sed "s/[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/")
38+
MAJOR=$(echo "${VERSION}" | sed "s/^\([0-9]*\).*/\1/")
39+
MINOR=$(echo "${VERSION}" | sed "s/[0-9]*\.\([0-9]*\).*/\1/")
40+
PATCH=$(echo "${VERSION}" | sed "s/[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/")
4041

41-
NEXT_MAJOR_VERSION="$(expr ${MAJOR} + 1).0.0"
42-
NEXT_MINOR_VERSION="${MAJOR}.$(expr ${MINOR} + 1)"
43-
NEXT_PATCH_VERSION="${MAJOR}.${MINOR}.$(expr ${PATCH} + 1)"
42+
NEXT_MAJOR_VERSION="$((MAJOR + 1)).0.0"
43+
NEXT_MINOR_VERSION="${MAJOR}.$((MINOR + 1))"
44+
NEXT_PATCH_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
4445

4546
modCreation() {
4647
mkdir -p "${PKG_TARGET}/DEBIAN"
4748
cp -rf mod/* ${PKG_TARGET}/
4849
{
4950
printf "%s\n" \
5051
"Package: ${PKG_NAME}" \
52+
"Author: ${PKG_CREATOR}" \
5153
"Version: ${VERSION}" \
54+
"Built: $(date)" \
55+
"Section: mods" \
56+
"Priority: optional" \
5257
"Architecture: ${ARCHITECTURE}" \
53-
"Depends: ${DEPENDS}" \
58+
"Platform: ${PLATFORM} ${ARCHITECTURE}" \
5459
"Maintainer: ${MAINTAINER}" \
5560
"Description: ${PKG_PRETTY_NAME}"
5661
cat mod_description.txt
57-
echo "Author: ${PKG_CREATOR}"
58-
echo "Platform: ${PLATFORM} ${ARCHITECTURE}"
59-
echo "Built: $(date)"
6062
} >>${CONTROL}
6163

6264
[ -f "preinst" ] && cp -rf preinst ${PREINST} && chmod 755 ${PREINST}
6365
[ -f "postinst" ] && cp -rf postinst ${POSTINST} && chmod 755 ${POSTINST}
6466
[ -f "postrm" ] && cp -rf postrm ${POSTRM} && chmod 755 ${POSTRM}
6567

66-
dpkg-deb -v --build ${PKG_TARGET}
68+
dpkg-deb -b ${PKG_TARGET}
6769
mv ${PKG_TARGET}.deb ${PKG_TARGET}.mod
6870

6971
rm -r ${PKG_TARGET:?}/
@@ -97,9 +99,9 @@ major)
9799
clean
98100
modCreation
99101
echo "${NEXT_PATCH_VERSION}" >VERSION
100-
if [ $(checkVersion ${VERSION}) -gt $(checkVersion ${LAST_TAG}) ]; then
101-
git tag $VERSION
102+
if [ "$(checkVersion "${VERSION}")" -gt "$(checkVersion "${LAST_TAG}")" ]; then
103+
git tag "$VERSION"
102104
fi
103105
;;
104106
esac
105-
#EOF
107+
#EOF

0 commit comments

Comments
 (0)