Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Install
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PET Computação
Install
Commits
c9594243
Commit
c9594243
authored
9 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Script verifica se usuário é root
parent
1e7d4abe
No related branches found
No related tags found
1 merge request
!2
Script debian-based
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
debian-based/install.sh
+12
-3
12 additions, 3 deletions
debian-based/install.sh
with
12 additions
and
3 deletions
debian-based/install.sh
+
12
−
3
View file @
c9594243
...
@@ -3,6 +3,15 @@
...
@@ -3,6 +3,15 @@
PACKAGES
=
PACKAGES
=
RUBY_VERSION
=
2.3.0
RUBY_VERSION
=
2.3.0
ABSOLUTE_PATH
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
ABSOLUTE_PATH
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
#Checa se o usuário é root
if
[[
$EUID
-ne
0
]]
then
ROOT
=
"sudo"
else
ROOT
=
fi
#Ruby precisa de uma função especial para ser instalado através do RVM
#Ruby precisa de uma função especial para ser instalado através do RVM
function
ruby
{
function
ruby
{
gpg
--keyserver
hkp://keys.gnupg.net
--recv-keys
409B6B1796C275462A1703113804BB82D39DC0E3
gpg
--keyserver
hkp://keys.gnupg.net
--recv-keys
409B6B1796C275462A1703113804BB82D39DC0E3
...
@@ -24,8 +33,7 @@ function install {
...
@@ -24,8 +33,7 @@ function install {
function
fresh-install
{
function
fresh-install
{
update
update
install
install
sudo
apt-get
install
-y
$PACKAGES
$(
echo
"
$ROOT
apt-get install -y
$PACKAGES
"
)
ruby
}
}
function
list
{
function
list
{
...
@@ -41,6 +49,7 @@ function help {
...
@@ -41,6 +49,7 @@ function help {
echo
" -l lista os pacotes disponíveis"
echo
" -l lista os pacotes disponíveis"
echo
"exemplo de uso:"
echo
"exemplo de uso:"
echo
"
$(
basename
"
$0
"
)
php mysql ruby"
echo
"
$(
basename
"
$0
"
)
php mysql ruby"
echo
"AVISO: por padrão, o ruby não é instalado. Para instalar, execute
$(
basename
"
$0
"
)
ruby"
}
}
#Se o arquivo não existe, o script cria
#Se o arquivo não existe, o script cria
...
@@ -90,7 +99,7 @@ done
...
@@ -90,7 +99,7 @@ done
#Checa se a string não está vazia
#Checa se a string não está vazia
if
[
!
-z
"
${
PACKAGES
//
}
"
]
if
[
!
-z
"
${
PACKAGES
//
}
"
]
then
then
sudo
apt-get
install
-y
$PACKAGES
$(
echo
"
$ROOT
apt-get install -y
$PACKAGES
"
)
else
else
help
help
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment