Skip to content

Commit

Permalink
update: CLI commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mc256 committed Nov 10, 2022
1 parent bef460d commit 9acf9be
Show file tree
Hide file tree
Showing 29 changed files with 906 additions and 375 deletions.
2 changes: 1 addition & 1 deletion DETAILS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ make && sudo make install
```shell
starlight-grpc run --server $STARLIGHT_PROXY_ADDRESS --socket /run/starlight-grpc/starlight-snapshotter.socket
```
or uses systemd service in `./demo/deb-package/debian/starlight-snapshotter.service`
or uses systemd service in `./demo/deb-package/debian/starlight.service`

---

Expand Down
67 changes: 33 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ COMPILEDATE=$(shell date +%Y%m%d)


.PHONY: build clean build-starlight-proxy build-starlight-daemon build-ctr-starlight

.SILENT: install-systemd-service

######################################################################
Expand Down Expand Up @@ -60,24 +59,24 @@ set-production:

.PHONY: generate-changelog
generate-changelog:
mkdir -p ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/ 2>/dev/null | true
sh -c ./demo/deb-package/generate-changelog.sh > ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/changelog
mkdir -p ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/ 2>/dev/null | true
sh -c ./demo/deb-package/generate-changelog.sh > ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/changelog

.PHONY: create-deb-package
create-deb-package: change-version-number set-production build-starlight-daemon build-ctr-starlight generate-changelog
mkdir -p ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/ 2>/dev/null | true
cp -r ./demo/deb-package/debian ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/
mkdir -p ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight-snapshotter/usr/bin/ 2>/dev/null | true
cp -r ./out/* ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight-snapshotter/usr/bin/
sed -i 's/Standards-Version: 0.0.0/Standards-Version: $(VERSIONNUMBER)/g' ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
cd ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE) ; \
mkdir -p ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/ 2>/dev/null | true
cp -r ./demo/deb-package/debian ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/
mkdir -p ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight/usr/bin/ 2>/dev/null | true
cp -r ./out/* ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight/usr/bin/
sed -i 's/Standards-Version: 0.0.0/Standards-Version: $(VERSIONNUMBER)/g' ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
cd ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE) ; \
dh_systemd_enable; \
dh_systemd_start; \
dh_installdeb; \
dh_gencontrol; \
dh_md5sums; \
dh_builddeb
dpkg-deb --info ./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb
dpkg-deb --info ./sandbox/starlight_$(VERSIONNUMBER)_amd64.deb

.PHONY: update-protobuf
update-protobuf:
Expand All @@ -95,53 +94,53 @@ create-deb-package.amd64: create-deb-package

.PHONY: create-deb-package.armv6l
create-deb-package.armv6l: change-version-number set-production build-starlight-daemon build-ctr-starlight generate-changelog
mkdir -p ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/ 2>/dev/null | true
cp -r ./demo/deb-package/debian ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/
mkdir -p ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight-snapshotter/usr/bin/ 2>/dev/null | true
cp -r ./out/* ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight-snapshotter/usr/bin/
sed -i 's/Standards-Version: 0.0.0/Standards-Version: $(VERSIONNUMBER)/g' ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
sed -i 's/Architecture: amd64/Architecture: armhf/g' ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
cd ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE) ; \
mkdir -p ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/ 2>/dev/null | true
cp -r ./demo/deb-package/debian ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/
mkdir -p ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight/usr/bin/ 2>/dev/null | true
cp -r ./out/* ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight/usr/bin/
sed -i 's/Standards-Version: 0.0.0/Standards-Version: $(VERSIONNUMBER)/g' ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
sed -i 's/Architecture: amd64/Architecture: armhf/g' ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
cd ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE) ; \
dh_systemd_enable; \
dh_systemd_start; \
dh_installdeb; \
dh_gencontrol; \
dh_md5sums; \
dh_builddeb
dpkg-deb --info ./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb
dpkg-deb --info ./sandbox/starlight_$(VERSIONNUMBER)_armhf.deb

.PHONY: create-deb-package.arm64
create-deb-package.arm64: change-version-number set-production build-starlight-daemon build-ctr-starlight generate-changelog
mkdir -p ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/ 2>/dev/null | true
cp -r ./demo/deb-package/debian ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/
mkdir -p ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight-snapshotter/usr/bin/ 2>/dev/null | true
cp -r ./out/* ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight-snapshotter/usr/bin/
sed -i 's/Standards-Version: 0.0.0/Standards-Version: $(VERSIONNUMBER)/g' ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
sed -i 's/Architecture: amd64/Architecture: arm64/g' ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
cd ./sandbox/starlight-snapshotter-$(VERSIONNUMBER)-$(COMPILEDATE) ; \
mkdir -p ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/ 2>/dev/null | true
cp -r ./demo/deb-package/debian ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/
mkdir -p ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight/usr/bin/ 2>/dev/null | true
cp -r ./out/* ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/starlight/usr/bin/
sed -i 's/Standards-Version: 0.0.0/Standards-Version: $(VERSIONNUMBER)/g' ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
sed -i 's/Architecture: amd64/Architecture: arm64/g' ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE)/debian/control
cd ./sandbox/starlight-$(VERSIONNUMBER)-$(COMPILEDATE) ; \
dh_systemd_enable; \
dh_systemd_start; \
dh_installdeb; \
dh_gencontrol; \
dh_md5sums; \
dh_builddeb
dpkg-deb --info ./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb
dpkg-deb --info ./sandbox/starlight_$(VERSIONNUMBER)_arm64.deb


.PHONY: upload-deb-package.amd64
upload-deb-package.amd64:
curl --form uploadfile='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb' $(UPLOAD_URL)
#curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb' https://repo.yuri.moe/api/files/starlight-snapshotter
curl --form uploadfile='@./sandbox/starlight_$(VERSIONNUMBER)_amd64.deb' $(UPLOAD_URL)
#curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight_$(VERSIONNUMBER)_amd64.deb='@./sandbox/starlight_$(VERSIONNUMBER)_amd64.deb' https://repo.yuri.moe/api/files/starlight

.PHONY: upload-deb-package.armv6l
upload-deb-package.armv6l:
curl --form uploadfile='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb' $(UPLOAD_URL)
#curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb' https://repo.yuri.moe/api/files/starlight-snapshotter
curl --form uploadfile='@./sandbox/starlight_$(VERSIONNUMBER)_armhf.deb' $(UPLOAD_URL)
#curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight_$(VERSIONNUMBER)_armhf.deb='@./sandbox/starlight_$(VERSIONNUMBER)_armhf.deb' https://repo.yuri.moe/api/files/starlight

.PHONY: upload-deb-package.amd64
upload-deb-package.arm64:
curl --form uploadfile='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb' $(UPLOAD_URL)
#curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb' https://repo.yuri.moe/api/files/starlight-snapshotter
curl --form uploadfile='@./sandbox/starlight_$(VERSIONNUMBER)_arm64.deb' $(UPLOAD_URL)
#curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight_$(VERSIONNUMBER)_arm64.deb='@./sandbox/starlight_$(VERSIONNUMBER)_arm64.deb' https://repo.yuri.moe/api/files/starlight

######################################################################
.PHONY: docker-buildx-multi-arch
Expand Down Expand Up @@ -186,9 +185,9 @@ install-systemd-service:
#@printf "Please enter Starlight Proxy address (example: \033[92mproxy.mc256.dev:8090\033[0m):"
#@read proxy_address; \
#echo $$proxy_address; \
#service_file=`cat './demo/deb-package/debian/starlight-snapshotter.service'`; \
#service_file=`cat './demo/deb-package/debian/starlight.service'`; \
#echo `subst "STARLIGHT_PROXY",$(proxy_address),$(service_file)`; \
#cp ./demo/deb-package/debian/starlight-snapshotter.service /lib/systemd/system/
#cp ./demo/deb-package/debian/starlight.service /lib/systemd/system/
#systemctl daemon-reload

docker-image:
Expand Down
Loading

0 comments on commit 9acf9be

Please sign in to comment.