Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikN committed May 31, 2024
1 parent 947ae9f commit 8f3907b
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
squashfs-root/
*.snap
squashfs-root/
exported.txt
81 changes: 81 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8f3907b

Please sign in to comment.