Skip to content
Snippets Groups Projects
Commit b9ca4dcd authored by Eric Frias's avatar Eric Frias
Browse files

Remove unnecessary sudo (this script only runs as root)

parent beca53da
No related branches found
No related tags found
1 merge request!85Don't hard-code the 'haf-world' docker-compose prefix in assisted startup.
Pipeline #118959 failed
...@@ -226,11 +226,11 @@ if [[ $? == 1 ]]; then ...@@ -226,11 +226,11 @@ if [[ $? == 1 ]]; then
fi fi
echo "Total free space on NVMEs: $(( $TOTAL_SPACE / 1000000000 )) G" echo "Total free space on NVMEs: $(( $TOTAL_SPACE / 1000000000 )) G"
echo "Found NVME devices: $NVMES" echo "Found NVME devices: $NVMES"
echo "sudo $CALLSTRING" echo "$CALLSTRING"
read -p "Create a zpool with these drives? (Y or N): " choice read -p "Create a zpool with these drives? (Y or N): " choice
if [[ "$choice" == "Y" || "$choice" == "y" ]]; then if [[ "$choice" == "Y" || "$choice" == "y" ]]; then
echo "Creating zpool..." echo "Creating zpool..."
sudo $CALLSTRING $CALLSTRING
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
echo "zpool created successfully." echo "zpool created successfully."
else else
...@@ -277,10 +277,10 @@ else ...@@ -277,10 +277,10 @@ else
if [[ $physical_memory -ge 60 && $free_memory -gt 30 && $NO_RAMDISK != 1 ]]; then if [[ $physical_memory -ge 60 && $free_memory -gt 30 && $NO_RAMDISK != 1 ]]; then
echo "There is more than 64 gigabytes of RAM. Mounting shared_mem..." echo "There is more than 64 gigabytes of RAM. Mounting shared_mem..."
if [ ! -d "/mnt/haf_shared_mem" ]; then if [ ! -d "/mnt/haf_shared_mem" ]; then
sudo mkdir /mnt/haf_shared_mem mkdir /mnt/haf_shared_mem
fi fi
sudo mount -t tmpfs -o size=25g tmpfs /mnt/haf_shared_mem mount -t tmpfs -o size=25g tmpfs /mnt/haf_shared_mem
sudo chown 1000:100 /mnt/haf_shared_mem chown 1000:100 /mnt/haf_shared_mem
remove_shared_mem=25 remove_shared_mem=25
else else
remove_shared_mem=0 remove_shared_mem=0
...@@ -387,10 +387,10 @@ while read -r line; do ...@@ -387,10 +387,10 @@ while read -r line; do
lowest_priority_file="/swapfile" lowest_priority_file="/swapfile"
swap_type="file" swap_type="file"
fi fi
sudo dd if=/dev/zero of=$lowest_priority_file+ count=32K bs=1M dd if=/dev/zero of=$lowest_priority_file+ count=32K bs=1M
sudo chmod 600 $lowest_priority_file+ chmod 600 $lowest_priority_file+
sudo mkswap $lowest_priority_file+ mkswap $lowest_priority_file+
sudo swapon $lowest_priority_file+ swapon $lowest_priority_file+
making_swap=0 making_swap=0
made_swap=1 made_swap=1
else else
...@@ -428,9 +428,9 @@ else ...@@ -428,9 +428,9 @@ else
# Move the shared_mem file to the blockchain directory # Move the shared_mem file to the blockchain directory
if [[ $remove_shared_mem != 0 ]]; then if [[ $remove_shared_mem != 0 ]]; then
sed -i "s#^$modified_HAF_SHM#$original_HAF_SHM#g" .env sed -i "s#^$modified_HAF_SHM#$original_HAF_SHM#g" .env
sudo cp /mnt/haf_shared_mem/shared_memory.bin /$ZPOOL/$TOP_LEVEL_DATASET/shared_memory cp --sparse=always /mnt/haf_shared_mem/shared_memory.bin /$ZPOOL/$TOP_LEVEL_DATASET/shared_memory
sudo chown 1000:100 /$ZPOOL/$TOP_LEVEL_DATASET/shared_memory/shared_memory.bin chown 1000:100 /$ZPOOL/$TOP_LEVEL_DATASET/shared_memory/shared_memory.bin
sudo umount /mnt/haf_shared_mem umount /mnt/haf_shared_mem
fi fi
...@@ -440,7 +440,7 @@ else ...@@ -440,7 +440,7 @@ else
fi fi
# Create a snapshot of the ZFS pool # Create a snapshot of the ZFS pool
sudo ./snapshot_zfs_datasets.sh $SNAPSHOT_NAME ./snapshot_zfs_datasets.sh $SNAPSHOT_NAME
# Restart Docker Compose # Restart Docker Compose
docker compose up -d docker compose up -d
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment