forked from Xastir/Xastir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.sudo
86 lines (62 loc) · 3.35 KB
/
README.sudo
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
SUDO Instructions:
------------------
"sudo" is a command that can make your life much simpler. After you set
it up that is! By adding a couple of lines to your /etc/sudoers file
(using the "visudo" command to edit this file), you'll be able to run a few
commands as root without having to type the root password each time.
Another thing you can do at that point is automate the entire
"git pull; mkdir build; cd build; ../configure; su; make install"
process via a script. Here's how to set all of this up:
Type "su" to become the root user, then type "visudo". This will bring up
the "vi" editor on the /etc/sudoers file. If you'd like to learn more
about what I'm going to describe, type "man sudoers" in another window and
read about this file. Another man-page that is useful here is the "man
sudo" page.
Back to the editing: There's a section in there for user alias. Mine is
labeled "# User alias specification". Add a line there that reads like
this:
User_Alias XASTIR = username1, username2, username3
where username1, etc, are valid usernames that you wish to be able to do
Xastir installs. For instance you might have:
User_Alias XASTIR = mikey
Next, add a line near the bottom that reads like this:
XASTIR ALL = NOPASSWD: /bin/chmod, /usr/bin/make
Now write out and close the file. At this point the "mikey" user will have
root permissions when he/she runs the commands "/bin/chmod" or
"/usr/bin/make". Make sure the paths to those programs are correct for
your system.
Exit from "su" so that you're a regular (non-root) user again.
Now, in the "xastir" source directory (mine is in "~/src/xastir"), create a
script that reads like this. I named my script "update-xastir" but nearly
any name for the script will do:
-----------------cut here--------------------
#! /bin/sh
git pull
./bootstrap.sh
mkdir build
cd build
../configure
sudo make clean
sudo make install
sudo chmod 4755 /usr/local/bin/xastir
-----------------cut here--------------------
Now type "chmod u+rwx update-xastir" to make that script executable.
Actually, we've just created a script for Xastir that implements the above
and called it "update-xastir". Do a "git pull" to get it.
Try out the script. Type:
./update-xastir
It should run through the entire update/configure/make/install process for
Xastir. Remember to either change to the proper xastir directory before
running it, or add a "cd" command at the beginning of the script so that it
will run in the proper directory in all cases. If you add the proper "cd"
command you can copy the script to /usr/local/bin and then run it as
"update-xastir" from anywhere.
Windows users: You may need to remove the "sudo" keyword on each line to
have it work properly for you.
A note from Gerry Creager as to another way to set up the sudoers file:
"I now consider it a good idea to add the "gifted" users to the 'wheel'
group and then solely enable wheel in /etc/sudoers; I've seen a recent
article also supporting this."
------------------------------------------------------------------------
Copyright (C) 1999 Frank Giannandrea
Copyright (C) 2000-2016 The Xastir Group