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
6497627f
Commit
6497627f
authored
Oct 19, 2013
by
Michal Siwek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement upgrading software, reorganize updating software lists and crew itself
parent
65dc5640
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
22 deletions
+92
-22
crew
crew
+92
-22
No files found.
crew
View file @
6497627f
...
...
@@ -45,6 +45,92 @@ def search (pkgName, silent = false)
abort
"package
#{
pkgName
}
not found :("
end
def
update
abort
"'crew update' is used to update crew itself. Use 'crew upgrade <packageName> to upgrade a specific package."
if
@pkgName
#update package lists
Dir
.
chdir
CREW_LIB_PATH
do
system
"git fetch origin master"
system
"git reset --hard origin/master"
end
puts
"Package lists updated."
#update crew
puts
"Updating crew..."
Dir
.
chdir
CREW_PREFIX
+
'/bin'
do
# system "sudo", "wget", "--no-check-certificate", "-N", "https://raw.github.com/skycocker/chromebrew/master/crew"
system
"sudo"
,
"chmod"
,
"+x"
,
"crew"
end
#update crew library
Dir
.
chdir
CREW_LIB_PATH
do
system
"wget"
,
"--no-check-certificate"
,
"-N"
,
"https://raw.github.com/skycocker/chromebrew/master/lib/package.rb"
system
"wget"
,
"--no-check-certificate"
,
"-N"
,
"https://raw.github.com/skycocker/chromebrew/master/lib/package_helpers.rb"
end
#check for outdated installed packages
puts
"Checking for package updates..."
puts
""
canBeUpdated
=
0
@device
[
:installed_packages
].
each
do
|
package
|
search
package
[
:name
],
true
if
package
[
:version
]
!=
@pkg
.
version
canBeUpdated
+=
1
puts
@pkg
.
name
+
" could be updated from "
+
package
[
:version
]
+
" to "
+
@pkg
.
version
end
end
if
canBeUpdated
>
0
puts
""
puts
"Run 'crew upgrade' to upgrade everything or 'crew upgrade <packageName>' to upgrade a specific package."
else
puts
"Your software is up to date."
end
end
def
upgrade
if
@pkgName
search
@pkgName
currentVersion
=
nil
@device
[
:installed_packages
].
each
do
|
package
|
if
package
[
:name
]
==
@pkg
.
name
currentVersion
=
package
[
:version
]
end
end
if
currentVersion
!=
@pkg
.
version
search
@pkg
.
name
puts
"Updating
#{
@pkg
.
name
}
..."
remove
resolveDependenciesAndInstall
else
puts
"
#{
@pkg
.
name
}
is already up to date."
end
else
toBeUpdated
=
[]
@device
[
:installed_packages
].
each
do
|
package
|
search
package
[
:name
],
true
if
package
[
:version
]
!=
@pkg
.
version
toBeUpdated
.
push
(
package
[
:name
])
end
end
if
toBeUpdated
.
length
>
0
puts
"Updating packages..."
toBeUpdated
.
each
do
|
package
|
search
package
remove
resolveDependenciesAndInstall
end
puts
"Packages have been updated."
else
puts
"Your software is already up to date."
end
end
end
def
download
if
@pkg
.
binary_url
&&
@pkg
.
binary_url
.
has_key?
(
@device
[
:architecture
])
url
=
@pkg
.
binary_url
[
@device
[
:architecture
]]
...
...
@@ -71,7 +157,7 @@ def download
end
def
resolveDependenciesAndInstall
origin
=
@pkg
N
ame
origin
=
@pkg
.
n
ame
resolveDependencies
...
...
@@ -242,7 +328,7 @@ def remove
out
=
JSON
.
parse
@device
.
to_json
file
.
write
JSON
.
pretty_generate
(
out
)
end
puts
"
#{
@pkg
N
ame
.
capitalize
}
removed!"
puts
"
#{
@pkg
.
n
ame
.
capitalize
}
removed!"
end
case
@command
...
...
@@ -256,25 +342,9 @@ when "download"
search
@pkgName
download
when
"update"
unless
@pkgName
==
'crew'
Dir
.
chdir
CREW_LIB_PATH
do
system
"git fetch origin master"
system
"git reset --hard origin/master"
end
puts
"Package lists updated."
else
abort
'Updating crew itself must be done as root.'
unless
USER
==
'root'
#update crew binary
Dir
.
chdir
CREW_PREFIX
+
'/bin'
do
system
"wget"
,
"-N"
,
"https://raw.github.com/skycocker/chromebrew/master/crew"
system
"sudo"
,
"chmod"
,
"+x"
,
"crew"
end
#update crew library
Dir
.
chdir
CREW_LIB_PATH
do
system
"wget"
,
"-N"
,
"https://raw.github.com/skycocker/chromebrew/master/lib/package.rb"
system
"wget"
,
"-N"
,
"https://raw.github.com/skycocker/chromebrew/master/lib/package_helpers.rb"
end
end
update
when
"upgrade"
upgrade
when
"install"
search
@pkgName
resolveDependenciesAndInstall
...
...
@@ -283,7 +353,7 @@ when "remove"
search
@pkgName
remove
when
nil
puts
"Chromebrew, version 0.
1
.1"
puts
"Chromebrew, version 0.
2
.1"
puts
"Usage: crew [command] [package]"
puts
"Available commands: search, download, install, remove"
else
...
...
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