File: fixpaths.sh

package info (click to toggle)
fdroidserver 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,740 kB
  • ctags: 941
  • sloc: python: 7,608; xml: 3,226; sh: 1,137; php: 887; java: 84; ruby: 28; makefile: 22
file content (25 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

echo $0

fixit()
{
  #Fix sudoers so the PATH gets passed through, otherwise chef
  #provisioning doesn't work.
  if [ -z "$1" ]; then
    export EDITOR=$0 && sudo -E visudo
  else
    echo "Fix sudoers"
    echo "Defaults exempt_group=admin" >> $1
  fi
  #Stick the gems bin onto root's path as well.
  sudo echo "PATH=$PATH:/var/lib/gems/1.8/bin" >>/root/.bashrc
  # Restart sudo so it gets the changes straight away
  sudo /etc/init.d/sudo restart
}

sudo grep "exempt_group" /etc/sudoers -q
if [ "$?" -eq "1" ]; then
  fixit
fi