Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chromebrew
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
chromebrew
Commits
f69606f5
Commit
f69606f5
authored
May 11, 2017
by
Ed Reel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update crew and install.sh to remove the need for sudo
parent
3995b637
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
22 deletions
+21
-22
crew
crew
+14
-15
install.sh
install.sh
+7
-7
No files found.
crew
View file @
f69606f5
...
@@ -104,7 +104,7 @@ def update
...
@@ -104,7 +104,7 @@ def update
system
"git reset --hard origin/master"
system
"git reset --hard origin/master"
end
end
puts
"Package lists, crew, and library updated."
puts
"Package lists, crew, and library updated."
#check for outdated installed packages
#check for outdated installed packages
puts
"Checking for package updates..."
puts
"Checking for package updates..."
puts
""
puts
""
...
@@ -117,7 +117,7 @@ def update
...
@@ -117,7 +117,7 @@ def update
puts
@pkg
.
name
+
" could be updated from "
+
package
[
:version
]
+
" to "
+
@pkg
.
version
puts
@pkg
.
name
+
" could be updated from "
+
package
[
:version
]
+
" to "
+
@pkg
.
version
end
end
end
end
if
canBeUpdated
>
0
if
canBeUpdated
>
0
puts
""
puts
""
puts
"Run 'crew upgrade' to upgrade everything or 'crew upgrade <packageName>' to upgrade a specific package."
puts
"Run 'crew upgrade' to upgrade everything or 'crew upgrade <packageName>' to upgrade a specific package."
...
@@ -136,7 +136,7 @@ def upgrade
...
@@ -136,7 +136,7 @@ def upgrade
currentVersion
=
package
[
:version
]
currentVersion
=
package
[
:version
]
end
end
end
end
if
currentVersion
!=
@pkg
.
version
if
currentVersion
!=
@pkg
.
version
puts
"Updating
#{
@pkg
.
name
}
..."
puts
"Updating
#{
@pkg
.
name
}
..."
@pkg
.
in_upgrade
=
true
@pkg
.
in_upgrade
=
true
...
@@ -153,7 +153,7 @@ def upgrade
...
@@ -153,7 +153,7 @@ def upgrade
toBeUpdated
.
push
(
package
[
:name
])
toBeUpdated
.
push
(
package
[
:name
])
end
end
end
end
if
toBeUpdated
.
length
>
0
if
toBeUpdated
.
length
>
0
puts
"Updating packages..."
puts
"Updating packages..."
toBeUpdated
.
each
do
|
package
|
toBeUpdated
.
each
do
|
package
|
...
@@ -262,11 +262,11 @@ def install_package (pkgdir)
...
@@ -262,11 +262,11 @@ def install_package (pkgdir)
FileUtils
.
mv
'filelist'
,
CREW_CONFIG_PATH
+
"meta/
#{
@pkg
.
name
}
.filelist"
FileUtils
.
mv
'filelist'
,
CREW_CONFIG_PATH
+
"meta/
#{
@pkg
.
name
}
.filelist"
File
.
open
(
CREW_CONFIG_PATH
+
"meta/
#{
@pkg
.
name
}
.directorylist"
).
each_line
do
|
line
|
File
.
open
(
CREW_CONFIG_PATH
+
"meta/
#{
@pkg
.
name
}
.directorylist"
).
each_line
do
|
line
|
system
"
sudo"
,
"
mkdir"
,
"-p"
,
line
.
chomp
system
"mkdir"
,
"-p"
,
line
.
chomp
end
end
File
.
open
(
CREW_CONFIG_PATH
+
"meta/
#{
@pkg
.
name
}
.filelist"
).
each_line
do
|
line
|
File
.
open
(
CREW_CONFIG_PATH
+
"meta/
#{
@pkg
.
name
}
.filelist"
).
each_line
do
|
line
|
system
"
sudo"
,
"
mv"
,
pkgdir
+
line
.
chomp
,
line
.
chomp
system
"mv"
,
pkgdir
+
line
.
chomp
,
line
.
chomp
end
end
end
end
end
end
...
@@ -276,10 +276,10 @@ def resolve_dependencies_and_install
...
@@ -276,10 +276,10 @@ def resolve_dependencies_and_install
origin
=
@pkg
.
name
origin
=
@pkg
.
name
resolveDependencies
resolveDependencies
search
origin
,
true
search
origin
,
true
install
install
rescue
InstallError
=>
e
rescue
InstallError
=>
e
abort
"
#{
@pkg
.
name
}
failed to install:
#{
e
.
to_s
}
"
abort
"
#{
@pkg
.
name
}
failed to install:
#{
e
.
to_s
}
"
ensure
ensure
#cleanup
#cleanup
...
@@ -320,7 +320,7 @@ def resolveDependencies
...
@@ -320,7 +320,7 @@ def resolveDependencies
end
end
end
end
end
end
push_dependencies
push_dependencies
# Add buildessential and solve its dependencies if any of dependent
# Add buildessential and solve its dependencies if any of dependent
...
@@ -330,16 +330,16 @@ def resolveDependencies
...
@@ -330,16 +330,16 @@ def resolveDependencies
search
'buildessential'
,
true
search
'buildessential'
,
true
end
end
push_dependencies
push_dependencies
return
if
@dependencies
.
empty?
return
if
@dependencies
.
empty?
puts
"Following packages also need to be installed: "
puts
"Following packages also need to be installed: "
@dependencies
.
flatten!
.
uniq!
@dependencies
.
flatten!
.
uniq!
@dependencies
.
each
do
|
dep
|
@dependencies
.
each
do
|
dep
|
print
dep
+
" "
print
dep
+
" "
end
end
puts
""
puts
""
puts
"Do you agree? [Y/n]"
puts
"Do you agree? [Y/n]"
response
=
STDIN
.
getc
response
=
STDIN
.
getc
...
@@ -398,7 +398,7 @@ def install
...
@@ -398,7 +398,7 @@ def install
puts
"Installing..."
puts
"Installing..."
install_package
dest_dir
install_package
dest_dir
end
end
#add to installed packages
#add to installed packages
@device
[
:installed_packages
].
push
(
name:
@pkg
.
name
,
version:
@pkg
.
version
)
@device
[
:installed_packages
].
push
(
name:
@pkg
.
name
,
version:
@pkg
.
version
)
File
.
open
(
CREW_CONFIG_PATH
+
'device.json'
,
'w'
)
do
|
file
|
File
.
open
(
CREW_CONFIG_PATH
+
'device.json'
,
'w'
)
do
|
file
|
...
@@ -547,10 +547,9 @@ when "build"
...
@@ -547,10 +547,9 @@ when "build"
search
@pkgName
search
@pkgName
resolve_dependencies_and_build
resolve_dependencies_and_build
when
"remove"
when
"remove"
abort
'Removing actions must be ran with sudo.'
unless
USER
==
'root'
remove
@pkgName
remove
@pkgName
when
nil
when
nil
puts
"Chromebrew, version 0.4.
1
"
puts
"Chromebrew, version 0.4.
2
"
puts
"Usage: crew [command] [package]"
puts
"Usage: crew [command] [package]"
puts
"Available commands: build, download, install, remove, search, update, upgrade, whatprovides"
puts
"Available commands: build, download, install, remove, search, update, upgrade, whatprovides"
else
else
...
...
install.sh
View file @
f69606f5
...
@@ -25,9 +25,12 @@ case "$architecture" in
...
@@ -25,9 +25,12 @@ case "$architecture" in
exit
1
;;
exit
1
;;
esac
esac
#This will allow things to work without sudo
sudo chown
-R
`
id
-u
`
:
`
id
-g
`
/usr/local
#prepare directories
#prepare directories
for
dir
in
$CREW_LIB_PATH
$CREW_CONFIG_PATH
$CREW_CONFIG_PATH
/meta
$CREW_BREW_DIR
$CREW_DEST_DIR
$CREW_PACKAGES_PATH
;
do
for
dir
in
$CREW_LIB_PATH
$CREW_CONFIG_PATH
$CREW_CONFIG_PATH
/meta
$CREW_BREW_DIR
$CREW_DEST_DIR
$CREW_PACKAGES_PATH
;
do
sudo mkdir
-p
$dir
&&
sudo chown
-R
$USER
:
$USER
$dir
mkdir
-p
$dir
done
done
#prepare url and sha256
#prepare url and sha256
...
@@ -96,7 +99,7 @@ function extract_install () {
...
@@ -96,7 +99,7 @@ function extract_install () {
rm
-rf
./usr
rm
-rf
./usr
tar
-xf
$2
tar
-xf
$2
echo
"Installing
$1
(this may take a while)..."
echo
"Installing
$1
(this may take a while)..."
sudo tar
cf - ./usr/
*
|
(
cd
/
;
sudo tar
xp
--keep-directory-symlink
-f
-
)
tar
cf - ./usr/
*
mv
./dlist
$CREW_CONFIG_PATH
/meta/
$1
.directorylist
mv
./dlist
$CREW_CONFIG_PATH
/meta/
$1
.directorylist
mv
./filelist
$CREW_CONFIG_PATH
/meta/
$1
.filelist
mv
./filelist
$CREW_CONFIG_PATH
/meta/
$1
.filelist
}
}
...
@@ -156,7 +159,7 @@ rm -rf crew lib packages
...
@@ -156,7 +159,7 @@ rm -rf crew lib packages
wget
-N
$URL
/crew
wget
-N
$URL
/crew
chmod
+x crew
chmod
+x crew
rm
-f
$CREW_PREFIX
/bin/crew
rm
-f
$CREW_PREFIX
/bin/crew
sudo
ln
-s
`
pwd
`
/crew
$CREW_PREFIX
/bin
ln
-s
`
pwd
`
/crew
$CREW_PREFIX
/bin
#install crew library
#install crew library
mkdir
-p
$CREW_LIB_PATH
/lib
mkdir
-p
$CREW_LIB_PATH
/lib
cd
$CREW_LIB_PATH
/lib
cd
$CREW_LIB_PATH
/lib
...
@@ -165,10 +168,7 @@ wget -N $URL/lib/package_helpers.rb
...
@@ -165,10 +168,7 @@ wget -N $URL/lib/package_helpers.rb
#Making GCC act like CC (For some npm packages out there)
#Making GCC act like CC (For some npm packages out there)
rm
-f
/usr/local/bin/cc
rm
-f
/usr/local/bin/cc
sudo ln
-s
/usr/local/bin/gcc /usr/local/bin/cc
ln
-s
/usr/local/bin/gcc /usr/local/bin/cc
#This will allow a lot of things to work without sudo
sudo chown
-R
`
id
-u
`
:
`
id
-g
`
/usr/local
#prepare sparse checkout .rb packages directory and do it
#prepare sparse checkout .rb packages directory and do it
cd
$CREW_LIB_PATH
cd
$CREW_LIB_PATH
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment