-
-
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
9871794
commit c481d30
Showing
11 changed files
with
204 additions
and
36 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,7 @@ | ||
.env | ||
*.deb | ||
*.snap | ||
parts/ | ||
stage/ | ||
snap/ | ||
packages/ |
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,5 +1,11 @@ | ||
Package: shreyam-do | ||
Version: 1.0 | ||
Version: 1.0.1 | ||
Architecture: all | ||
Maintainer: Shreyam Maity <rey@shreyam.dev> | ||
Description: A package that contains my personal server setup scripts | ||
Homepage: https://shreyam.dev | ||
Source: shreyam-do | ||
Section: misc | ||
Priority: optional | ||
Depends: make | ||
Pre-Depends: make |
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
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,24 +1,15 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt-get update && \ | ||
apt-get clean && \ | ||
# apt-get install -y snapcraft dpkg-dev build-essential && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /pkg | ||
|
||
COPY . . | ||
|
||
ARG PACKAGE_NAME | ||
ARG PACKAGE_VERSION | ||
ENV SNAPCRAFT_DISABLE_REMOTE_PARTS=true | ||
|
||
RUN chmod 755 /pkg/DEBIAN/postinst | ||
RUN mkdir -p /packages && \ | ||
dpkg-deb --build /pkg /packages/${PACKAGE_NAME}_${PACKAGE_VERSION}.deb | ||
# && \ | ||
# cd /pkg && \ | ||
# snapcraft | ||
dpkg-deb --build /pkg /packages/${PACKAGE_NAME}_${PACKAGE_VERSION}.deb | ||
|
||
CMD cp /packages/*.deb /build | ||
# && \ | ||
# cp /pkg/*.snap /build | ||
CMD cp /packages/*.deb /build |
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,13 @@ | ||
up: | ||
docker-compose --env-file=.env up -d --build | ||
docker-compose --env-file=.env up -d --build | ||
docker-compose down | ||
test: | ||
docker-compose --profile test --env-file=.env up -d --build | ||
version: | ||
@if [ -z "$(word 2, $(MAKECMDGOALS))" ]; then echo "Usage: make version <version>"; exit 1; fi | ||
@if [ ! -f DEBIAN/control ]; then echo "Error: DEBIAN/control does not exist"; exit 1; fi | ||
@echo "Current version: $(grep -oP 'Version: \K.*' DEBIAN/control | cut -d' ' -f1)" | ||
@echo "Setting version $(word 2, $(MAKECMDGOALS))" | ||
@sed -i "s/Version:.*/Version: $(word 2, $(MAKECMDGOALS))/" DEBIAN/control | ||
@echo "New version: $(grep -oP 'Version: \K.*' DEBIAN/control | cut -d' ' -f1)" | ||
@echo "Done" |
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
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,10 +1,35 @@ | ||
version: "3" | ||
services: | ||
build: | ||
shreyam-do: | ||
build: | ||
context: . | ||
args: | ||
PACKAGE_NAME: ${PACKAGE_NAME:-shreyam-do} | ||
PACKAGE_VERSION: ${VERSION:-1.0.0} | ||
volumes: | ||
- ./build:/build | ||
tests: | ||
image: ubuntu:22.04 | ||
volumes: | ||
- ./build:/build | ||
environment: | ||
- LC_ALL=C.UTF-8 | ||
- LANG=C.UTF-8 | ||
- PACKAGE_NAME=${PACKAGE_NAME:-shreyam-do} | ||
- VERSION=${VERSION:-1.0.0} | ||
working_dir: /tmp | ||
depends_on: | ||
- shreyam-do | ||
profiles: | ||
- test | ||
command: sh -c ' | ||
set -e; | ||
apt-get update; | ||
apt-get install -y make; | ||
cd /build; | ||
ls -l; | ||
dpkg -i /build/${PACKAGE_NAME}_${VERSION}.deb; | ||
shreyam-do -v; | ||
shreyam-do -h; | ||
shreyam-do test; | ||
shreyam-do' |
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
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
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,3 +1,67 @@ | ||
#!/bin/bash | ||
|
||
make -f /usr/share/shreyam-do/Makefile "$@" | ||
set -e | ||
|
||
function print_usage { | ||
make -s -f /usr/share/shreyam-do/Makefile help | ||
} | ||
|
||
function print_version { | ||
echo "shreyam-do version 1.0.1" | ||
} | ||
|
||
function setup_all { | ||
echo "Setting up all packages" | ||
sudo apt-get update | ||
sudo apt-get install -y git | ||
sudo apt-get install -y vim | ||
sudo apt-get install -y curl | ||
sudo apt-get install -y zsh | ||
sudo apt-get install -y tmux | ||
sudo apt-get install -y npm | ||
chsh -s $(which zsh) | ||
which $SHELL | ||
/usr/bin/zsh | ||
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions | ||
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh | ||
echo "Setup complete" | ||
} | ||
|
||
if [ $# -eq 0 ]; then | ||
print_usage | ||
exit 1 | ||
fi | ||
|
||
while [[ $# -gt 0 ]]; do | ||
key="$1" | ||
|
||
case $key in | ||
-h | --help) | ||
print_usage | ||
exit 0 | ||
;; | ||
-v | --version) | ||
print_version | ||
exit 0 | ||
;; | ||
-s | --setup) | ||
setup_all | ||
exit 0 | ||
;; | ||
-r | --remove) | ||
echo "Removing all installed packages" | ||
sudo apt-get remove -y tmux | ||
sudo apt-get remove -y npm | ||
exit 0 | ||
;; | ||
*) | ||
# if the argument doesn't match any flag, execute the make command | ||
make -s -f /usr/share/shreyam-do/Makefile "$@" | ||
exit 0 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
print_usage | ||
exit 1 |
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