update makefile with install operation

software
a2nr 2024-09-24 14:23:37 +07:00
parent eed9e324a7
commit 32ab6390af
2 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,7 @@
TARGET_USER := a2nr TARGET_USER := a2nr
TARGET_HOST := tritium-h5 TARGET_HOST := tritium-h5
TARGET_PATH := /home/$(TARGET_USER)/Documents/dashboard TARGET_PATH := /home/$(TARGET_USER)/heartbeatmice/dashboard
TARGET_PATH_STR := \/home\/$(TARGET_USER)\/heartbeatmice\/dashboard
TARGET_PASS := 'a2nr' TARGET_PASS := 'a2nr'
PROBE_USER := a2nr PROBE_USER := a2nr
PROBE_HOST := mekatronika PROBE_HOST := mekatronika
@ -10,7 +11,9 @@ PROBE_PASS := 'Bismillah...'
all: comp up run all: comp up run
debug: comp_debug up run_debug debug: comp_debug up run_debug
init: install_dep install_flutter_pi init: install_dep install_flutter_pi
up: comp copy_target up: copy_target
install: comp up install_app
uninstall: uninstall_app
clean: clean:
rm -rf ./build/* && sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S rm -rf $(TARGET_PATH)/*' rm -rf ./build/* && sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S rm -rf $(TARGET_PATH)/*'
@ -19,11 +22,17 @@ comp_debug:
comp: comp:
flutterpi_tool build --arch=arm64 --release flutterpi_tool build --arch=arm64 --release
copy_target: copy_target:
sshpass -p $(TARGET_PASS) rsync -a --info=progress2 ./build/flutter_assets $(TARGET_USER)@$(TARGET_HOST):$(TARGET_PATH) sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'mkdir -p $(TARGET_PATH)' \
&& sshpass -p $(TARGET_PASS) rsync -a --info=progress2 ./build/flutter_assets $(TARGET_USER)@$(TARGET_HOST):$(TARGET_PATH)
run: run:
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S flutter-pi -r 270 --release $(TARGET_PATH)/flutter_assets' sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S flutter-pi -r 270 --release $(TARGET_PATH)/flutter_assets'
run_debug: run_debug:
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S flutter-pi -o landscape_left $(TARGET_PATH)/flutter_assets' sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S flutter-pi -o landscape_left $(TARGET_PATH)/flutter_assets'
install_app:
sshpass -p $(TARGET_PASS) rsync -a --info=progress2 ./heartbeatmice.service $(TARGET_USER)@$(TARGET_HOST):$(TARGET_PATH) \
&& sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'sed -i -e "s/@thepath/$(TARGET_PATH_STR)/g" $(TARGET_PATH)/heartbeatmice.service && echo $(TARGET_PASS) | sudo -S cp $(TARGET_PATH)/heartbeatmice.service /lib/systemd/system/ && echo $(TARGET_PASS) | sudo -S systemctl enable heartbeatmice.service && echo $(TARGET_PASS) | sudo -S systemctl start heartbeatmice.service'
uninstall_app:
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S systemctl stop heartbeatmice.service && echo $(TARGET_PASS) | sudo -S systemctl disable heartbeatmice.service && echo $(TARGET_PASS) | sudo -S rm /lib/systemd/system/heartbeatmice.service'
install_dep: install_dep:
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S apt-get -y install cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev libudev-dev libxkbcommon-dev \ sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S apt-get -y install cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev libudev-dev libxkbcommon-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa' libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa'

View File

@ -0,0 +1,9 @@
[Unit]
Description=Heartbeatmice dari UM
[Service]
Type=simple
ExecStart=flutter-pi -r 90 --release @thepath/flutter_assets
[Install]
WantedBy=multi-user.target