Added dependency installation for janitor

This commit is contained in:
Yessiest 2022-12-11 03:12:17 +04:00
parent 0d3131a8f9
commit 64051ede9b
2 changed files with 49 additions and 18 deletions

View File

@ -1,21 +1,45 @@
task default: [:install] task default: [:install]
ConfigPath = (ENV["XDG_DATA_HOME"] or ENV["HOME"]+'/.config') ConfigPath = (ENV["XDG_DATA_HOME"] or ENV["HOME"]+'/.config')
desc "Copy files to .config" desc "Install (copy) config files"
file "copy-config" => ["rc.lua"] do task "install-files" do
base = ["libs","modules","themes","widgets","rc.lua","desktop.conf"]
sh "mkdir -p #{ConfigPath}/awesome" sh "mkdir -p #{ConfigPath}/awesome"
["libs","modules","themes","widgets","rc.lua","desktop.conf"].each { |x| base.each { |f|
cp_r "./#{x}" "#{ConfigPath}/awesome" cp_r "./#{f}", "#{ConfigPath}/awesome"
} }
end end
desc "Compile and install luapam" desc "Install LuaPAM"
file "build-luapam" => "#{ConfigPath}/libs/pam.so" do task "install-luapam" do
unless File.exist? "#{ConfigPath}/awesome/libs/pam.so"
sh "sh ./extra/install_luapam.sh" sh "sh ./extra/install_luapam.sh"
cp "./pam.so","#{ConfigPath}/awesome/libs/"
cp_r "./pam","#{ConfigPath}/awesome/libs/"
rm "./pam.so"
rm_rf "./pam"
rm_rf "./lua-pam"
else
puts "LuaPAM already installed - skipping"
end
end end
desc "Force install config"
task "install-force" => ["install-files","install-luapam"]
desc "Install config" desc "Install config"
task install: ["copy-config","build-luapam"] task :install do
installed = true
base = ["libs","modules","themes","widgets","rc.lua","desktop.conf"]
(base+["libs/pam.so"]).each { |f|
installed &= File.exist? "#{ConfigPath}/awesome/#{f}"
}
if installed
puts "Baseline files already installed - skipping"
else
Rake::Task["install-force"].invoke
end
end
desc "Build documentation" desc "Build documentation"
task :doc do task :doc do
@ -27,14 +51,14 @@ task "install-extra" do
if Process.euid != 0 if Process.euid != 0
raise Exception, "You need to be root to install extras" raise Exception, "You need to be root to install extras"
end end
cp "./extra/udev/backlight.rules" "/etc/udev/rules.d" cp "./extra/udev/backlight.rules", "/etc/udev/rules.d"
mkdir "#{ConfigPath}/autostart" mkdir "#{ConfigPath}/autostart"
begin begin
cp "/usr/share/applications/picom.desktop" "#{ConfigPath}/autostart/" cp "/usr/share/applications/picom.desktop", "#{ConfigPath}/autostart/"
rescue rescue
puts "picom not installed - ignoring" puts "picom not installed - ignoring"
else else
cp "./extra/picom.conf" "#{ConfigPath}" cp "./extra/picom.conf", "#{ConfigPath}"
end end
puts "Done! Reload awesome to complete installation" puts "Done! Reload awesome to complete installation"
end end
@ -44,6 +68,14 @@ task :clean do
rm_rf "#{ConfigPath}/awesome" rm_rf "#{ConfigPath}/awesome"
end end
desc "Install dependencies for code cleaner"
task "install-janitor-deps" do
if Process.euid != 0
raise Exception, "You need to be root to install gems"
end
Gem.install "language_server-protocol"
end
desc "Wipe configuration and reinstall from scratch" desc "Wipe configuration and reinstall from scratch"
task reinstall: [:clean,:install] task reinstall: [:clean,:install]

View File

@ -16,12 +16,11 @@ if [ "$LUA_VERSION" == "" ]; then
exit 1 exit 1
fi fi
echo "Target version: $LUA_VERSION" echo "Target version: $LUA_VERSION"
git clone --recursive https://github.com/devurandom/lua-pam ~/.config/awesome/lua-pam git clone --recursive https://github.com/devurandom/lua-pam lua-pam
cd ~/.config/awesome/lua-pam cd lua-pam
make LUA_VERSION="$LUA_VERSION" make LUA_VERSION="$LUA_VERSION"
mkdir -p ~/.config/awesome/libs/pam/ mkdir -p ../pam/
cp LICENSE ~/.config/awesome/libs/pam/ cp LICENSE ../pam/
echo "https://github.com/devurandom/lua-pam" > ~/.config/awesome/libs/pam/README echo "https://github.com/devurandom/lua-pam" > ../pam/README
cp pam.so ~/.config/awesome/libs/ cp pam.so ../
rm -rf ~/.config/awesome/lua-pam