FIX call emacs as normal user

This commit is contained in:
Nathan Dwarshuis 2021-03-13 20:55:59 -05:00
parent 8dca74f8d2
commit bd1c5e2a4a
2 changed files with 8 additions and 7 deletions

View File

@ -14,8 +14,9 @@
## 6. remove the temporary HOME for yay
## 7. remove the pacman sudo privilege for nobody
pkgsrc_dir="$1"
emacs_dir="$2"
home_user="$1"
pkgsrc_dir="$2"
emacs_dir="$3"
makepkg_tmp=/tmp/bootstrap-makepkg
yaytmp=/tmp/bootstrap-yay
@ -62,10 +63,10 @@ run_yay() {
## packages for emacs (install emacs first to read the config)
pacman --needed -S emacs
emacs -batch -l "$emacs_dir/init.el" --eval \
sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" --eval \
'(print (format "pkgs: %s" (s-join " " (nd/get-aur-dependencies t))))'
IFS=' ' read -r -a emacs_pkgs \
< <(emacs -batch -l "$emacs_dir/init.el" --eval \
< <(sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" --eval \
'(print (format "pkgs: %s" (s-join " " (nd/get-aur-dependencies t))))' \
2>/dev/null \
sed -n -e 's/"pkgs: \(.*\)"/\1/p')
@ -147,8 +148,8 @@ if [[ ! "$(id -u)" = "0" ]]; then
exit 1
fi
if [ "$#" -ne 2 ]; then
echo "Must supply custom package location and emacs root. Exiting"
if [ "$#" -ne 3 ]; then
echo "Must supply calling user, custom package dir, and emacs dir. Exiting"
exit 1
fi

View File

@ -44,7 +44,7 @@ clone_maybe https://github.com/ndwarshuis/.emacs.d.git "$emacs_dir"
# only be used once. Pass the emacs config directory so it can get a list of
# dependencies for emacs
sudo "$HOME/.bin/bootstrap_pkgs" "$HOME/.local/share/packages" "$emacs_dir"
sudo "$(id -u)" "$HOME/.bin/bootstrap_pkgs" "$HOME/.local/share/packages" "$emacs_dir"
# Install Haskell dependencies for emacs. This is only necessary because some
# Haskell programs are not packaged as "bin" or "stack" packages, in which case