├── README.md
├── install.sh
├── resources
├── og-tiny-ramdisk-dark.png
├── og-tiny-ramdisk-light.png
├── tiny-ramdisk-done-symbolic.svg
├── tiny-ramdisk-fail-symbolic.svg
├── tiny-ramdisk-symbolic.svg
├── tiny-ramdisk-wait-symbolic.svg
└── tiny-ramdisk.svg
├── src
├── tiny-ramdisk-shutdown-exec.sh
├── tiny-ramdisk-shutdown-noexec.sh
├── tiny-ramdisk-startup-exec.sh
├── tiny-ramdisk-startup-noexec.sh
├── tiny-ramdisk.policy
└── tiny-ramdisk.service
└── uninstall.sh
/README.md:
--------------------------------------------------------------------------------
1 | TinyRAMDisk • Persistent RAM Drive for Linux
2 | ============================================
3 |
4 | 
5 | 
6 |
7 | What is a RAM Disk?
8 | -------------------
9 |
10 | RAM drive functionality can significantly benefit older computers with slow hard drive speeds. Hard Disk (HDD or SSD) read and write operations are moved to the Random Access Memory (RAM). Therefore depending on the particular computer hardware, user may experience up to 10x productivity boost.
11 |
12 | High file operation speeds are crucial when user puts heavy I/O on the filesystem. RAM disk not only provides better read and write speeds, but also takes the stress off the hard drive which increases its life expectancy.
13 |
14 | Possible scenarios for the RAM disk can be:
15 | * Working with large project in Integrated Development Environments (IDEs).
16 | * Running computational analysis of numerous small size files.
17 |
18 | Why Choose TinyRAMDisk?
19 | ------------------------
20 |
21 | Simplicity is often the key. TinyRAMDisk has a minimal footprint on the system. Program consists from a few bash scripts and systemd service. Below please find some of the program features:
22 |
23 | * **Persistent**. Files are saved back and restored from the hard drive each time user logs off.
24 | * **High speeds**. Data only resides in RAM (`ramfs`, not `tmpfs`) and will never end up on the `swap` partition.
25 | * **Dynamic size**. RAM disk partition dynamically increases in size as more files are added.
26 | * **Multi user**. Each user on the system can install and use his instance of RAM disk.
27 |
28 | > [!IMPORTANT]
29 | > User is responsible to keep track of the amount of data stored on the RAM disk. Ensure it does not exceed available RAM size. Otherwise system may have unpredictable behavior.
30 |
31 | How to Install
32 | --------------
33 |
34 | **Prerequisites**. Any GNU/Linux distribution with `systemd` suite and `PolicyKit` component. Ensure that `rsync`, `systemd`, and `notify-send` are installed on your computer (provided by default with most distributions). Next, open Terminal emulator and enter following commands:
35 |
36 | ```
37 | git clone https://github.com/petrstepanov/tiny-ramdisk
38 | cd ./tiny-ramdisk
39 | chmod +x ./install.sh && install.sh
40 | ```
41 |
42 | The RAM disk is mounted in the `RAMDisk` folder in home folder. On logout or restart files are saved in the hidden `~/.RAMDisk` folder.
43 |
44 | > [!TIP]
45 | > When working with a large amount of files on the RAM drive, it is reasonable to turn off your desktop environment indexing and search functionality on the RAM drive. In GNOME desktop environment this will be under Settings → Search → Search Locations...
46 |
47 | How to Uninstall
48 | ----------------
49 |
50 | Execute following command inside the program folder:
51 |
52 | ```
53 | chmod +x ./uninstall.sh && uninstall.sh
54 | ```
55 |
56 | After uninstalling the RAM disk files are copied in the `~/.RAMDisk` home directory.
57 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #/bin/bash
2 |
3 | # TODO: parameterise the RAMDisk folder name via template systemd service @
4 | # TODO: use reverse dns naming com.github.petrstepanov.tiny-ramdisk to avoid name clashes
5 | BIN_FOLDER=$HOME/.local/bin
6 | SYSTEMD_FOLDER=$HOME/.local/share/systemd/user
7 | ICON_FOLDER=$HOME/.local/share/icons/hicolor/scalable/apps
8 | SYMBOLIC_ICON_FOLDER=$HOME/.local/share/icons/hicolor/symbolic/apps
9 | RAMDISK_FOLDER=$HOME/RAMDisk
10 | RAMDISK_PERSISTENT_FOLDER=$HOME/.RAMDisk
11 |
12 | # Create entry in /etc/fstab
13 | echo "INFO: Creating ramfs entry in /etc/fstab."
14 | sudo sed -i "/#ramdisk-$USER/d" /etc/fstab
15 | echo "none $RAMDISK_FOLDER ramfs rw,exec,noauto,user,mode=1777 0 0 #ramdisk-$USER" | sudo tee -a /etc/fstab
16 |
17 | # Make `mount` recognize changes in `fstab`: https://unix.stackexchange.com/q/477794/340672
18 | sudo systemctl daemon-reload
19 |
20 | # Copy startup and shutdown scripts
21 | # Tip: copying, not moving because copying inherits file properties, of its parent directory (ownership, etc).
22 | # https://osric.com/chris/accidental-developer/2019/01/cp-mv-ownership-attributes/
23 | mkdir -p $BIN_FOLDER
24 |
25 | # Check which RAMDisk scripts to install - with or without executable permissions on the drive?
26 | while true; do
27 | read -p "QUESTION: Do you need executable permissions on the RAMDisk? (yes/no) " YN
28 | case $YN in
29 | yes )
30 | echo -e "INFO: Ok. Copying startup and shutdown scripts."
31 | cp ./src/tiny-ramdisk-startup-exec.sh $BIN_FOLDER/tiny-ramdisk-startup.sh
32 | cp ./src/tiny-ramdisk-shutdown-exec.sh $BIN_FOLDER/tiny-ramdisk-shutdown.sh
33 | echo -e "INFO: Installing the policy file."
34 | sudo cp ./src/tiny-ramdisk.policy /usr/share/polkit-1/actions
35 | sudo mv /usr/share/polkit-1/actions/tiny-ramdisk.policy /usr/share/polkit-1/actions/tiny-ramdisk.$USER.policy
36 | sudo sed -i "s;%USER%;$USER;g" /usr/share/polkit-1/actions/tiny-ramdisk.$USER.policy
37 | break;;
38 | no )
39 | echo -e "INFO: Ok. Copying startup and shutdown scripts."
40 | cp ./src/tiny-ramdisk-startup-noexec.sh $BIN_FOLDER/tiny-ramdisk-startup.sh
41 | cp ./src/tiny-ramdisk-shutdown-noexec.sh $BIN_FOLDER/tiny-ramdisk-shutdown.sh
42 | break;;
43 | * )
44 | echo invalid response
45 | exit 1
46 | break;;
47 | esac
48 | done
49 |
50 | # Add executable permissions to RAMDisk scripts
51 | chmod +x $BIN_FOLDER/tiny-ramdisk-*
52 |
53 | # Install application icon for pkexec dialog (may be needed)
54 | # All icons are installed to "hicolor" fallback icon theme folder: https://askubuntu.com/a/300155/925071
55 | echo "INFO: Installing application icons."
56 | mkdir -p $ICON_FOLDER
57 | cp ./resources/tiny-ramdisk.svg $ICON_FOLDER
58 | xdg-desktop-menu forceupdate
59 |
60 | # Install symbolic icons for notifications
61 | mkdir -p $SYMBOLIC_ICON_FOLDER
62 | cp ./resources/tiny-ramdisk*symbolic.svg $SYMBOLIC_ICON_FOLDER
63 | gtk-update-icon-cache --ignore-theme-index $HOME/.local/share/icons/hicolor/
64 |
65 | # Create folder for user systemd scripts
66 | echo "INFO: Installing systemd service."
67 | mkdir -p $SYSTEMD_FOLDER
68 |
69 | # Copy systemd services
70 | # https://wiki.archlinux.org/title/systemd/User#Writing_user_units
71 | cp ./src/tiny-ramdisk.service $SYSTEMD_FOLDER
72 |
73 | # Stop the service (if running)
74 | systemctl --user stop tiny-ramdisk
75 | systemctl --user disable tiny-ramdisk
76 | systemctl --user daemon-reload
77 |
78 | # Start the service
79 | echo "INFO: Starting the RAMDisk service..."
80 | systemctl --user enable tiny-ramdisk
81 | systemctl --user start tiny-ramdisk
82 |
83 | # Show RAMDisk folder in Files application
84 | echo "INFO: Done! Path to your RAMDisk is ${RAMDISK_FOLDER}"
85 | xdg-open $RAMDISK_FOLDER
86 |
87 | # Success exit
88 | exit 0
89 |
--------------------------------------------------------------------------------
/resources/og-tiny-ramdisk-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petrstepanov/tiny-ramdisk/84c7f57b31134246af387f8214dbd8fe0f298dba/resources/og-tiny-ramdisk-dark.png
--------------------------------------------------------------------------------
/resources/og-tiny-ramdisk-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petrstepanov/tiny-ramdisk/84c7f57b31134246af387f8214dbd8fe0f298dba/resources/og-tiny-ramdisk-light.png
--------------------------------------------------------------------------------
/resources/tiny-ramdisk-done-symbolic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/resources/tiny-ramdisk-fail-symbolic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/resources/tiny-ramdisk-symbolic.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/resources/tiny-ramdisk-wait-symbolic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/resources/tiny-ramdisk.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/tiny-ramdisk-shutdown-exec.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Define variables
4 | RAMDISK_FOLDER="${HOME}/RAMDisk"
5 | RAMDISK_PERSISTENT_FOLDER="${HOME}/.RAMDisk"
6 | SYMBOLIC_ICON_FOLDER="${HOME}/.local/share/icons/hicolor/symbolic/apps"
7 |
8 | NS_ARGS=(--icon tiny-ramdisk-symbolic --app-name "Tiny RAMDisk")
9 | NS_WAIT_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-wait-symbolic.svg" --category transfer)
10 | NS_DONE_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-done-symbolic.svg" --category transfer.complete)
11 |
12 | # Create folder to save RAMDisk content
13 | mkdir -p $RAMDISK_PERSISTENT_FOLDER
14 |
15 | # Copy files from ramdisk (memory) to persistent folder
16 | # rsync interprets a directory with no trailing slash as `copy this directory`, and a directory with a trailing slash as copy the contents of this directory
17 | # --recursive -r recurse into directories
18 | # --links -l copy symlinks as symlinks
19 | # --ignore-existing skip updating files that exist on receiver
20 | # --times -t preserve modification times
21 | # --verbose -v increase verbosity
22 | # --delete delete extraneous files from dest dirs
23 |
24 | notify-send "${NS_ARGS[@]}" "${NS_WAIT_ARGS[@]}" "Please wait..." "Synchronizing RAMDisk files to persistent location."
25 |
26 | rsync -avul --delete $RAMDISK_FOLDER/ $RAMDISK_PERSISTENT_FOLDER
27 |
28 | notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" "Done!" "Files are saved to persistent location."
29 |
30 | # Unmount the volume with lazy option because `Target is Busy`
31 | pkexec chown root:root $RAMDISK_FOLDER
32 | pkexec umount --lazy $RAMDISK_FOLDER
33 | pkexec rm -rf $RAMDISK_FOLDER
34 |
35 | # Success exit
36 | exit 0
37 |
--------------------------------------------------------------------------------
/src/tiny-ramdisk-shutdown-noexec.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Define variables
4 | RAMDISK_FOLDER="${HOME}/RAMDisk"
5 | RAMDISK_PERSISTENT_FOLDER="${HOME}/.RAMDisk"
6 | SYMBOLIC_ICON_FOLDER="${HOME}/.local/share/icons/hicolor/symbolic/apps"
7 |
8 | NS_ARGS=(--icon tiny-ramdisk-symbolic --app-name "Tiny RAMDisk")
9 | NS_WAIT_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-wait-symbolic.svg" --category transfer)
10 | NS_DONE_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-done-symbolic.svg" --category transfer.complete)
11 |
12 | # Create folder to save RAMDisk content
13 | mkdir -p $RAMDISK_PERSISTENT_FOLDER
14 |
15 | # Copy files from ramdisk (memory) to persistent folder
16 | # rsync interprets a directory with no trailing slash as `copy this directory`, and a directory with a trailing slash as copy the contents of this directory
17 | # --recursive -r recurse into directories
18 | # --links -l copy symlinks as symlinks
19 | # --ignore-existing skip updating files that exist on receiver
20 | # --times -t preserve modification times
21 | # --verbose -v increase verbosity
22 | # --delete delete extraneous files from dest dirs
23 |
24 | notify-send "${NS_ARGS[@]}" "${NS_WAIT_ARGS[@]}" "Please wait..." "Synchronizing RAMDisk files to persistent location."
25 |
26 | rsync -avul --delete $RAMDISK_FOLDER/ $RAMDISK_PERSISTENT_FOLDER
27 |
28 | notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" "Done!" "Files are saved to persistent location."
29 |
30 | # Unmount the volume with lazy option because `Target is Busy`
31 | umount --lazy $RAMDISK_FOLDER
32 | rm -rf $RAMDISK_FOLDER
33 |
34 | # Success exit
35 | exit 0
36 |
--------------------------------------------------------------------------------
/src/tiny-ramdisk-startup-exec.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Define variables
4 | RAMDISK_FOLDER="${HOME}/RAMDisk"
5 | RAMDISK_PERSISTENT_FOLDER="${HOME}/.RAMDisk"
6 | SYMBOLIC_ICON_FOLDER="${HOME}/.local/share/icons/hicolor/symbolic/apps"
7 |
8 | # Man page for notify-send: https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html
9 | # https://man.archlinux.org/man/notify-send.1.en
10 | # Pass command args with quotes as bash variable: https://superuser.com/a/360986/206515
11 | NS_ARGS=(--icon tiny-ramdisk-symbolic --app-name "Tiny RAMDisk")
12 | NS_WAIT_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-wait-symbolic.svg" --category transfer)
13 | NS_DONE_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-done-symbolic.svg" --category transfer.complete)
14 | NS_FAIL_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-fail-symbolic.svg" --category transfer.error)
15 |
16 | # Create RAMDisk folder (if not exists)
17 | mkdir -p $RAMDISK_FOLDER
18 |
19 | # Mount the RAMDisk and change permissions
20 | pkexec mount -o exec $RAMDISK_FOLDER
21 | pkexec chown $USER:$USER $RAMDISK_FOLDER
22 |
23 | # Check pkexec status: https://linux.die.net/man/1/pkexec
24 | auth=$?
25 | if [ $auth = 0 ]; then
26 | # Copy persistent content to RAMDisk
27 | # Check if persistent folder exists
28 | if [ -d "$RAMDISK_PERSISTENT_FOLDER" ]
29 | then
30 | # Check if persistent folder contains some files
31 | if [ "$(ls -A $RAMDISK_PERSISTENT_FOLDER)" ]; then
32 | # Startup notification
33 | notify-send "${NS_ARGS[@]}" "${NS_WAIT_ARGS[@]}" "Please wait..." "Copying files to memory (RAM)."
34 | # Startup notification - remember the ID to replace it with subsequent success notification
35 | # ID=$(notify-send "${NS_ARGS[@]}" "${NS_WAIT_ARGS[@]}" --print-id "Please wait..." "Copying files to memory (RAM).")
36 | # Copy preserving the ownership, mode and timestamps
37 | cp -a $RAMDISK_PERSISTENT_FOLDER/* $RAMDISK_FOLDER/
38 | fi
39 | # Success notification
40 | notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" "Hey there!" "RAMDisk is ready to use."
41 | # Success notification replacing startup one. Problem: glitches,
42 | # notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" --replace-id ${ID} "Done!" "RAMDisk is ready to use."
43 | # Success notification with action. In GNOME if no action was selected - it freezes the process
44 | # ACTION=$(notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" --replace-id ${ID} --action "open=Show Files" --wait --expire-time 4000 "Done!" "RAMDisk is ready to use.")
45 | # case $ACTION in
46 | # open)
47 | # xdg-open $RAMDISK_FOLDER;;
48 | # *)
49 | # ;;
50 | # esac
51 | fi
52 | elif [ $auth = 126 ]; then
53 | # Error notification
54 | notify-send "${NS_ARGS[@]}" "${NS_FAIL_ARGS[@]}" "Oops!" "Error copying persistent files to RAM."
55 | fi
56 |
57 | # Success exit
58 | exit 0
59 |
--------------------------------------------------------------------------------
/src/tiny-ramdisk-startup-noexec.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Define variables
4 | RAMDISK_FOLDER="${HOME}/RAMDisk"
5 | RAMDISK_PERSISTENT_FOLDER="${HOME}/.RAMDisk"
6 | SYMBOLIC_ICON_FOLDER="${HOME}/.local/share/icons/hicolor/symbolic/apps"
7 |
8 | # Man page for notify-send: https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html
9 | # https://man.archlinux.org/man/notify-send.1.en
10 | # Pass command args with quotes as bash variable: https://superuser.com/a/360986/206515
11 | NS_ARGS=(--icon tiny-ramdisk-symbolic --app-name "Tiny RAMDisk")
12 | NS_WAIT_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-wait-symbolic.svg" --category transfer)
13 | NS_DONE_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-done-symbolic.svg" --category transfer.complete)
14 | NS_FAIL_ARGS=(--hint "string:image-path:${SYMBOLIC_ICON_FOLDER}/tiny-ramdisk-fail-symbolic.svg" --category transfer.error)
15 |
16 | # Create RAMDisk folder (if not exists)
17 | mkdir -p $RAMDISK_FOLDER
18 |
19 | # Mount the RAMDisk (no execute permissions)
20 | mount $RAMDISK_FOLDER
21 |
22 | # Check if persistent folder exists
23 | if [ -d "$RAMDISK_PERSISTENT_FOLDER" ]
24 | then
25 | # Check if permanent folder contains some files
26 | if [ "$(ls -A $RAMDISK_PERSISTENT_FOLDER)" ]; then
27 | # Startup notification
28 | notify-send "${NS_ARGS[@]}" "${NS_WAIT_ARGS[@]}" "Please wait..." "Copying files to memory (RAM)."
29 | # Startup notification - remember the ID to replace it with subsequent success notification
30 | # ID=$(notify-send "${NS_ARGS[@]}" "${NS_WAIT_ARGS[@]}" --print-id "Please wait..." "Copying files to memory (RAM).")
31 | # Copy preserving the ownership, mode and timestamps
32 | cp -a $RAMDISK_PERSISTENT_FOLDER/* $RAMDISK_FOLDER/
33 | # Success notification
34 | notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" "Done!" "RAMDisk is ready. Files available for read and write only."
35 | # Success notification replacing startup one. Problem: glitches.
36 | # notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" --replace-id ${ID} "Done!" "RAMDisk is ready. Files available for read and write only."
37 | # Success notification with action. Problem: if no action was selected it halts process execution
38 | # ACTION=$(notify-send "${NS_ARGS[@]}" "${NS_DONE_ARGS[@]}" --replace-id ${ID} --action "open=Show Files" --wait --expire-time 4000 "Done!" "RAMDisk is ready. Files available for read and write only.")
39 | # case $ACTION in
40 | # open)
41 | # xdg-open $RAMDISK_FOLDER;;
42 | # *)
43 | # ;;
44 | # esac
45 | fi
46 | fi
47 |
48 | # Success exit
49 | exit 0
50 |
--------------------------------------------------------------------------------
/src/tiny-ramdisk.policy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Petr Stepanov
5 | https://github.com/petrstepanov/tiny-ramdisk
6 |
7 |
8 | Tiny RAMDisk
9 | Authentication is required to mount RAMDisk with execute privilege
10 | tiny-ramdisk
11 |
12 | yes
13 | yes
14 | yes
15 |
16 | /usr/bin/mount
17 | -o
18 | exec
19 | /home/%USER%/RAMDisk
20 |
21 |
22 |
23 | Tiny RAMDisk
24 | Authentication is required to change RAMDisk files ownership
25 | tiny-ramdisk
26 |
27 | yes
28 | yes
29 | yes
30 |
31 | /usr/bin/chown
32 | %USER%:%USER%
33 | /home/%USER%/RAMDisk/
34 |
35 |
36 |
37 | Tiny RAMDisk
38 | Authentication is required to chown RAMDisk to super user
39 | tiny-ramdisk
40 |
41 | yes
42 | yes
43 | yes
44 |
45 | /usr/bin/chown
46 | root:root
47 | /home/%USER%/RAMDisk
48 |
49 |
50 |
51 | Tiny RAMDisk
52 | Authentication is required to unmount RAMDisk as super user
53 | tiny-ramdisk
54 |
55 | yes
56 | yes
57 | yes
58 |
59 | /usr/bin/umount
60 | --lazy
61 | /home/%USER%/RAMDisk
62 |
63 |
64 |
65 | Tiny RAMDisk
66 | Authentication is required to delete RAMDisk folder
67 | tiny-ramdisk
68 |
69 | yes
70 | yes
71 | yes
72 |
73 | /usr/bin/rm
74 | -rf
75 | /home/%USER%/RAMDisk
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/src/tiny-ramdisk.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Tiny RAMDisk
3 | After=graphical-session.target
4 |
5 | [Service]
6 | Type=oneshot
7 | RemainAfterExit=yes
8 | ExecStart=%h/.local/bin/tiny-ramdisk-startup.sh
9 | ExecStop=%h/.local/bin/tiny-ramdisk-shutdown.sh
10 | # ExecStartPre=/usr/bin/sleep 5
11 |
12 | [Install]
13 | WantedBy=graphical-session.target
14 |
--------------------------------------------------------------------------------
/uninstall.sh:
--------------------------------------------------------------------------------
1 | #/bin/bash
2 |
3 | # Define variables
4 | BIN_FOLDER=$HOME/.local/bin
5 | SYSTEMD_FOLDER=$HOME/.local/share/systemd/user
6 | ICON_FOLDER=$HOME/.local/share/icons/hicolor/scalable/apps
7 | SYMBOLIC_ICON_FOLDER=$HOME/.local/share/icons/hicolor/symbolic/apps
8 | RAMDISK_FOLDER=$HOME/RAMDisk
9 | RAMDISK_PERSISTENT_FOLDER=$HOME/.RAMDisk
10 |
11 | # Stop and remove systemd service
12 | echo "INFO: Disabling and removing the systemd service."
13 | systemctl --user stop tiny-ramdisk
14 | systemctl --user disable tiny-ramdisk
15 | systemctl --user daemon-reload
16 |
17 | # Remove systemd service file
18 | rm $SYSTEMD_FOLDER/tiny-ramdisk*
19 |
20 | # Remove icons and update icon cache
21 | echo "INFO: Removing app icons."
22 | rm $ICON_FOLDER/tiny-ramdisk.svg
23 | rm $SYMBOLIC_ICON_FOLDER/tiny-ramdisk*symbolic.svg
24 | xdg-desktop-menu forceupdate
25 | gtk-update-icon-cache --ignore-theme-index $HOME/.local/share/icons/hicolor/
26 |
27 | # Wipe entry from fstab for cuerrent user
28 | echo "INFO: Removing the fstab entry."
29 | sudo sed -i "/#ramdisk-$USER/d" /etc/fstab
30 |
31 | # Remove Policy file (if exists)
32 | echo "INFO: Wiping user policy file."
33 | FILE=/usr/share/polkit-1/actions/tiny-ramdisk.$USER.policy
34 | if [ -f "$FILE" ]; then
35 | sudo rm $FILE
36 | fi
37 |
38 | # Clean up user scripts
39 | echo "INFO: Cleaning up user scripts."
40 | rm $BIN_FOLDER/tiny-ramdisk-*
41 |
42 | # Success exit
43 | echo "INFO: RAMDisk is deleted! Your files are stored in ${RAMDISK_PERSISTENT_FOLDER}"
44 | exit 0
45 |
--------------------------------------------------------------------------------