kkimurak / ssl-setup

Bash script that setup the official RoboCup-SSL tools with required packages ( https://github.com/RoboCup-SSL/ )
4 stars 0 forks source link

permission denied when ~/Documents not exist #34

Closed kkimurak closed 5 years ago

kkimurak commented 5 years ago

When using xfce, ~/Desktop is the only directory that created in default.
And, in function install_liraries(), creating directory ~/Documents/sslinst_tmp - and this function is run as root.
So it will cause permission problem.
It is better to use temporal directory

idea : use mktemp


# current code
local path_tmp=/home/${SUDO_USER}/Documents/sslinst_tmp/
mkdir -p path_tmp && cd $_

# using mktemp : no need to mkdir, mktemp make directory and return its path
local path_tmp="$(mktemp)/sslinst_tmp/"