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
a476934b
Commit
a476934b
authored
Mar 11, 2021
by
satmandu
Committed by
GitHub
Mar 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update xdg_base.rb
parent
e670fe37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
packages/xdg_base.rb
packages/xdg_base.rb
+26
-23
No files found.
packages/xdg_base.rb
View file @
a476934b
...
@@ -3,45 +3,48 @@ require 'package'
...
@@ -3,45 +3,48 @@ require 'package'
class
Xdg_base
<
Package
class
Xdg_base
<
Package
description
'XDG Base Directory Specification Configuration'
description
'XDG Base Directory Specification Configuration'
homepage
'https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html'
homepage
'https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html'
version
'0.7-
6
'
version
'0.7-
7
'
compatibility
'all'
compatibility
'all'
source_url
'file:///dev/null'
source_url
'file:///dev/null'
source_sha256
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
source_sha256
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
def
self
.
preinstall
def
self
.
preinstall
# Save any previous configuration, if it exists.
# Save any previous configuration, if it exists.
if
File
.
directory?
(
"
#{
HOME
}
/.config"
)
&&
!
File
.
symlink?
(
"
#{
HOME
}
/.config"
)
if
File
.
directory?
(
"
#{
HOME
}
/.config"
)
&&
!
File
.
symlink?
(
"
#{
HOME
}
/.config"
)
&&
!
FileUtils
.
cp_r
(
"
#{
HOME
}
/.config"
,
FileUtils
.
rm_rf
(
"
#{
HOME
}
/.config"
)
unless
FileUtils
.
cp_r
(
"
#{
HOME
}
/.config"
,
"
#{
CREW_PREFIX
}
/"
)
"
#{
CREW_PREFIX
}
/"
)
FileUtils
.
rm_rf
(
"
#{
HOME
}
/.config"
)
end
end
if
File
.
directory?
(
"
#{
HOME
}
/.local"
)
&&
!
File
.
symlink?
(
"
#{
HOME
}
/.local"
)
if
File
.
directory?
(
"
#{
HOME
}
/.local"
)
&&
!
File
.
symlink?
(
"
#{
HOME
}
/.local"
)
&&
!
FileUtils
.
cp_r
(
"
#{
HOME
}
/.local/."
,
FileUtils
.
mkdir_p
(
"
#{
CREW_PREFIX
}
/.config"
)
unless
Dir
.
exists?
"
#{
CREW_PREFIX
}
/.config"
"
#{
CREW_PREFIX
}
/.config/"
)
FileUtils
.
rm_rf
(
"
#{
HOME
}
/.local"
)
unless
FileUtils
.
cp_r
(
"
#{
HOME
}
/.local/."
,
"
#{
CREW_PREFIX
}
/.config/"
)
# FileUtils.mkdir_p("#{CREW_PREFIX}/.config") unless Dir.exists? "#{CREW_PREFIX}/.config"
FileUtils
.
rm_rf
(
"
#{
HOME
}
/.local"
)
end
end
end
end
def
self
.
install
# Changes the ~/.config and ~/.local directories to use symlinks instead.
# This is needed in cases when executables are installed in these locations.
FileUtils
.
mkdir_p
(
CREW_DEST_HOME
)
FileUtils
.
mkdir_p
(
CREW_DEST_PREFIX
+
'/.config'
)
FileUtils
.
ln_s
(
CREW_PREFIX
+
'/.config'
,
CREW_DEST_HOME
+
'/.config'
)
FileUtils
.
ln_s
(
CREW_PREFIX
+
'/.config'
,
CREW_DEST_HOME
+
'/.local'
)
end
def
self
.
postinstall
def
self
.
postinstall
xdgconfig_in_bashrc
=
`grep -c "XDG_CONFIG_HOME" ~/.bashrc || true`
FileUtils
.
mkdir_p
"
#{
CREW_PREFIX
}
/.config/.local/share"
unless
xdgconfig_in_bashrc
.
to_i
.
positive?
FileUtils
.
mkdir_p
"
#{
CREW_PREFIX
}
/.cache"
FileUtils
.
mkdir_p
"
#{
CREW_PREFIX
}
/etc/xdg"
@_str
=
"XDG_CONFIG_HOME=
#{
CREW_PREFIX
}
/.config"
if
`grep -c '
#{
@_str
}
'
#{
HOME
}
/.bashrc`
.
to_i
.
zero?
puts
'Putting XDG Environment Variables in ~/.bashrc'
.
lightblue
puts
'Putting XDG Environment Variables in ~/.bashrc'
.
lightblue
system
"echo '# XDG Base Directory Specification Environment Variables' >> ~/.bashrc"
system
"echo '# See https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html' >> ~/.bashrc"
system
"echo '# See https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html' >> ~/.bashrc"
system
"echo 'export XDG_DATA_HOME=
#{
HOME
}
/.local/share' >> ~/.bashrc"
system
"echo '# XDG Base Directory Specification Environment Variables' >> ~/.bashrc"
system
"echo 'export XDG_CONFIG_HOME=
#{
HOME
}
/.config' >> ~/.bashrc"
system
"sed -i '/XDG_CACHE_HOME=/d' ~/.bashrc"
system
"echo 'export XDG_DATA_DIRS=
#{
CREW_PREFIX
}
/share' >> ~/.bashrc"
system
"sed -i '/XDG_CONFIG_DIRS/d' ~/.bashrc"
system
"sed -i '/XDG_CONFIG_HOME/d' ~/.bashrc"
system
"sed -i '/XDG_DATA_DIRS/d' ~/.bashrc"
system
"sed -i '/XDG_DATA_HOME/d' ~/.bashrc"
system
"sed -i '/XDG_RUNTIME_DIR/d' ~/.bashrc"
system
"echo 'export XDG_CACHE_HOME=
#{
CREW_PREFIX
}
/.cache' >> ~/.bashrc"
system
"echo 'export XDG_CONFIG_DIRS=
#{
CREW_PREFIX
}
/etc/xdg' >> ~/.bashrc"
system
"echo 'export XDG_CONFIG_DIRS=
#{
CREW_PREFIX
}
/etc/xdg' >> ~/.bashrc"
system
"echo 'export XDG_CACHE_HOME=
#{
HOME
}
/.cache' >> ~/.bashrc"
system
"echo 'export XDG_CONFIG_HOME=
#{
CREW_PREFIX
}
/.config' >> ~/.bashrc"
system
"echo 'export XDG_DATA_DIRS=
#{
CREW_PREFIX
}
/share' >> ~/.bashrc"
system
"echo 'export XDG_DATA_HOME=
#{
CREW_PREFIX
}
/.config/.local/share' >> ~/.bashrc"
system
"echo 'export XDG_RUNTIME_DIR=/var/run/chrome' >> ~/.bashrc"
system
"echo 'export XDG_RUNTIME_DIR=/var/run/chrome' >> ~/.bashrc"
puts
'To complete the installation, execute the following:'
.
orange
puts
'To complete the installation, execute the following:'
.
orange
puts
'source ~/.bashrc'
.
orange
puts
'source ~/.bashrc'
.
orange
puts
'or reboot'
.
red
end
end
end
end
end
end
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