-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0f53b7
commit 47f1f3b
Showing
4 changed files
with
106 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/husarion_motd | ||
nimcache/ | ||
package_dir | ||
husarion-motd-* | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# husarion-motd | ||
|
||
Welcome message for Linux-based Husarion devices | ||
|
||
## Building | ||
|
||
To build the package you need `nim`: | ||
|
||
``` | ||
sudo apt install nim | ||
``` | ||
|
||
You can use `build.sh` script to preapare `.deb` package: | ||
|
||
``` | ||
./build.sh | ||
``` | ||
|
||
Script will create a `.deb` package named according to pattern: `husarion-motd-VERSION-ARCH.deb` | ||
|
||
Install it with: | ||
|
||
``` | ||
sudo dpkg -i husarion-motd-VERSION-ARCH.deb | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
ARCHITECTURE=$(uname -m) | ||
VERSION='1.0.2' | ||
|
||
if [ $ARCHITECTURE = "x86_64" ] | ||
then | ||
ARCH='amd64' | ||
elif [[ $ARCHITECTURE = 'armv7l' ]] | ||
then | ||
ARCH='armhf' | ||
else | ||
echo 'Unsupported architecture' | ||
exit 1 | ||
fi | ||
|
||
rm -rf package_dir | ||
mkdir package_dir | ||
mkdir package_dir/DEBIAN | ||
mkdir package_dir/etc | ||
mkdir package_dir/etc/profile.d/ | ||
mkdir package_dir/usr | ||
mkdir package_dir/usr/bin | ||
|
||
echo "Package: husarion-motd | ||
Version: $VERSION | ||
Section: custom | ||
Priority: optional | ||
Architecture: $ARCH | ||
Essential: no | ||
Installed-Size: 1024 | ||
Maintainer: Husarion <[email protected]> | ||
Description: Welcome message for Linux-based Husarion devices" > package_dir/DEBIAN/control | ||
|
||
echo "#!/bin/sh | ||
set -e | ||
if [ -e /etc/motd -a ! -e /etc/motd.old ]; then | ||
mv /etc/motd /etc/motd.old | ||
touch /etc/motd | ||
fi | ||
chmod -x /etc/update-motd.d/*" > package_dir/DEBIAN/postinst | ||
chmod a+x package_dir/DEBIAN/postinst | ||
|
||
cp -a husarion-motd.sh package_dir/etc/profile.d/husarion-motd.sh | ||
|
||
|
||
if [ $ARCH = 'amd64' ] | ||
then | ||
nim compile --define:pro husarion_motd.nim | ||
elif [ $ARCH = 'armhf' ] | ||
then | ||
nim compile husarion_motd.nim | ||
fi | ||
|
||
mv husarion_motd package_dir/usr/bin/husarion-motd | ||
|
||
dpkg-deb --build package_dir husarion-motd-$VERSION-$ARCH.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters