diff --git a/.gitignore b/.gitignore index 160674f..2a86a39 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +squashfs-root/ *.snap -squashfs-root/ \ No newline at end of file +exported.txt \ No newline at end of file diff --git a/justfile b/justfile new file mode 100644 index 0000000..86c18d2 --- /dev/null +++ b/justfile @@ -0,0 +1,81 @@ +build: + #!/bin/bash + export SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=1 + snapcraft + +install: + #!/bin/bash + unsquashfs husarion-rplidar*.snap + sudo snap try squashfs-root/ + sudo snap connect husarion-rplidar:raw-usb + sudo husarion-rplidar.stop + +remove: + #!/bin/bash + sudo snap remove husarion-rplidar + sudo rm -rf squashfs-root/ + +clean: + #!/bin/bash + export SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=1 + snapcraft clean + +iterate: + #!/bin/bash + start_time=$(date +%s) + + echo "Starting script..." + + sudo snap remove husarion-rplidar + sudo rm -rf squashfs-root/ + sudo rm -rf husarion-rplidar*.snap + export SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=1 + snapcraft clean + snapcraft + unsquashfs husarion-rplidar*.snap + sudo snap try squashfs-root/ + sudo snap connect husarion-rplidar:raw-usb + + end_time=$(date +%s) + duration=$(( end_time - start_time )) + + hours=$(( duration / 3600 )) + minutes=$(( (duration % 3600) / 60 )) + seconds=$(( duration % 60 )) + + printf "Script completed in %02d:%02d:%02d (hh:mm:ss)\n" $hours $minutes $seconds + +swap-enable: + #!/bin/bash + sudo fallocate -l 3G /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + sudo swapon --show + + # Make the swap file permanent: + sudo bash -c "echo '/swapfile swap swap defaults 0 0' >> /etc/fstab" + + # Adjust swappiness: + sudo sysctl vm.swappiness=10 + sudo bash -c "echo 'vm.swappiness=10' >> /etc/sysctl.conf" + +swap-disable: + #!/bin/bash + sudo swapoff /swapfile + sudo rm /swapfile + sudo sed -i '/\/swapfile swap swap defaults 0 0/d' /etc/fstab # Remove the swap file entry + sudo sed -i '/vm.swappiness=10/d' /etc/sysctl.conf # Remove or comment out the swappiness setting + sudo sysctl -p # Reload sysctl configuration + +prepare-store-credentials: + #!/bin/bash + snapcraft export-login --snaps=husarion-rplidar \ + --acls package_access,package_push,package_update,package_release \ + exported.txt + +publish: + #!/bin/bash + export SNAPCRAFT_STORE_CREDENTIALS=$(cat exported.txt) + snapcraft login + snapcraft upload --release edge husarion-astra*.snap \ No newline at end of file