From 622d926ed9d700445dfe3c7ec1b0b21f67d46591 Mon Sep 17 00:00:00 2001
From: Walmes Zeviani <walmes@ufpr.br>
Date: Sun, 9 May 2021 19:00:59 -0300
Subject: [PATCH] Improves installation of R packages.

---
 install_R.sh      | 15 ++++++++++-----
 install_ubuntu.sh | 25 ++++++++-----------------
 2 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/install_R.sh b/install_R.sh
index 04c819d..bdf305f 100644
--- a/install_R.sh
+++ b/install_R.sh
@@ -251,7 +251,9 @@ if [ $opcao -eq 1 ]
 then
     echo "Instalando os pacotes mais usados do CRAN."
     espeak -v pt "Instalando os pacotes mais usados do CRAN."
-    Rscript -e \
+    mkdir -p /home/walmes/R/x86_64-pc-linux-gnu-library/4.0
+    ls /home/walmes/R/x86_64-pc-linux-gnu-library/4.0
+    sudo Rscript -e \
         'pkg <- c("agricolae", "AlgDesign", "alr4", "animation", "asbio",
                   "bbmle", "bookdown", "cairoDevice", "car", "contrast",
                   "corrplot", "curl", "data.table", "debug", "devtools",
@@ -276,9 +278,10 @@ then
                   "tikzDevice", "tm", "topicmodels", "tuber", "tweedie",
                   "waffle", "wordcloud", "XML", "xml2", "xtable");
          # lib <- "/usr/lib/R/site-library";
-         # repos <- "http://cran-r.c3sl.ufpr.br/";
-         # install.packages(pkg, dep = TRUE, lib = lib, repos = repos);
-         install.packages(pkg, dep = TRUE);
+         lib <- "/home/walmes/R/x86_64-pc-linux-gnu-library/4.0";
+         repos <- "http://cran-r.c3sl.ufpr.br/";
+         install.packages(pkg, dep = TRUE, lib = lib, repos = repos);
+         # install.packages(pkg, dep = TRUE);
          cat("\n\n\nInstalações concluídas!\n")'
     echo "Pacotes do R foram instalados do CRAN."
     espeak -v pt "Pacotes do R foram instalados do CRAN."
@@ -295,7 +298,9 @@ then
     espeak -v pt "Instalando os pacotes mais usados do GitHub."
     sudo apt-get install libavfilter-dev -y
     Rscript -e \
-        'devtools::install_github("rstudio/xaringan");
+        'lib <- "/home/walmes/R/x86_64-pc-linux-gnu-library/4.0";
+         .libPaths(new = lib);
+         install.packages("xaringan");
          devtools::install_github("gadenbuie/xaringanExtra");
          devtools::install_github("jhelvy/xaringanBuilder");
          devtools::install_github("rstudio/chromote");
diff --git a/install_ubuntu.sh b/install_ubuntu.sh
index 0b2b4b5..2e17d71 100644
--- a/install_ubuntu.sh
+++ b/install_ubuntu.sh
@@ -27,17 +27,9 @@ sudo rm -i /etc/apt/sources.list.d/SOME-NAME.list
 # sudo apt-get install emacs emacs-goodies-el -y
 sudo apt-get install build-essential -y
 
-sudo add-apt-repository ppa:kelleyk/emacs
+sudo add-apt-repository ppa:kelleyk/emacs -y
 sudo apt-get update
-# sudo apt-get install emacs26 -y
 sudo apt-get install emacs -y
-
-# ATTENTION: do NOT install `emacs-goodies-el` anymore. It brings only
-# `bm` package. The others are not used in my `init.el`.
-
-# `emacs` installls the following components:
-#   emacs25 emacs25-bin-common emacs25-common emacs25-el
-
 emacs --version # = 26.3
 
 #-----------------------------------------------------------------------
@@ -69,7 +61,7 @@ git clone git@github.com:walmes/doom-emacs.git ~/.doom.d/
 #-----------------------------------------------------------------------
 # Installs useful software, tools and components.
 
-     # nautilus-open-terminal nautilus-actions \
+# nautilus-open-terminal nautilus-actions \
 sudo apt-get install \
      bleachbit uudeview mpack arj cabextract \
      file-roller mencoder flac faac faad sox \
@@ -157,11 +149,10 @@ nautilus -q
 #-----------------------------------------------------------------------
 # Shutter.
 
-sudo add-apt-repository ppa:linuxuprising/shutter- y
+sudo add-apt-repository ppa:linuxuprising/shutter -y
 # sudo add-apt-repository --remove ppa:linuxuprising/shutter
 sudo apt-get update && sudo apt-get install shutter -y
 
-
 #-----------------------------------------------------------------------
 # GitKraken.
 
@@ -243,7 +234,7 @@ texdoc probsoln tikz pgfplots abntex2 abntex2cite-alf abntex2cite
 # Google Chrome.
 
 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -P ~/Downloads/
-sudo apt install ~/Downloads/google-chrome-stable_current_amd64.deb
+sudo apt install ~/Downloads/google-chrome-stable_current_amd64.deb -y
 
 # Solves: Google Chrome Asks Password to Unlock Login Keyring
 # https://tipsonubuntu.com/2017/12/20/google-chrome-asks-password-unlock-login-keyring/
@@ -439,10 +430,10 @@ sudo snap install scrcpy
 #-----------------------------------------------------------------------
 # OBS-Studio, Kdenlive and Audacity.
 
-sudo add-apt-repository ppa:obsproject/obs-studio -y
-sudo add-apt-repository ppa:kdenlive/kdenlive-stable -y
-sudo add-apt-repository ppa:ubuntuhandbook1/audacity -y
-sudo apt update
+sudo add-apt-repository ppa:obsproject/obs-studio -y && \
+sudo add-apt-repository ppa:kdenlive/kdenlive-stable -y && \
+sudo add-apt-repository ppa:ubuntuhandbook1/audacity -y && \
+sudo apt update && \
 sudo apt install obs-studio kdenlive kde-style-breeze audacity -y
 
 #-----------------------------------------------------------------------
-- 
GitLab