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]
ConfigPath = (ENV["XDG_DATA_HOME"] or ENV["HOME"]+'/.config')
desc "Copy files to .config"
file "copy-config" => ["rc.lua"] do
desc "Install (copy) config files"
task "install-files" do
base = ["libs","modules","themes","widgets","rc.lua","desktop.conf"]
sh "mkdir -p #{ConfigPath}/awesome"
["libs","modules","themes","widgets","rc.lua","desktop.conf"].each { |x|
cp_r "./#{x}" "#{ConfigPath}/awesome"
base.each { |f|
cp_r "./#{f}", "#{ConfigPath}/awesome"
}
end
desc "Compile and install luapam"
file "build-luapam" => "#{ConfigPath}/libs/pam.so" do
desc "Install LuaPAM"
task "install-luapam" do
unless File.exist? "#{ConfigPath}/awesome/libs/pam.so"
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
desc "Force install config"
task "install-force" => ["install-files","install-luapam"]
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"
task :doc do
@ -27,14 +51,14 @@ task "install-extra" do
if Process.euid != 0
raise Exception, "You need to be root to install extras"
end
cp "./extra/udev/backlight.rules" "/etc/udev/rules.d"
cp "./extra/udev/backlight.rules", "/etc/udev/rules.d"
mkdir "#{ConfigPath}/autostart"
begin
cp "/usr/share/applications/picom.desktop" "#{ConfigPath}/autostart/"
cp "/usr/share/applications/picom.desktop", "#{ConfigPath}/autostart/"
rescue
puts "picom not installed - ignoring"
else
cp "./extra/picom.conf" "#{ConfigPath}"
cp "./extra/picom.conf", "#{ConfigPath}"
end
puts "Done! Reload awesome to complete installation"
end
@ -44,6 +68,14 @@ task :clean do
rm_rf "#{ConfigPath}/awesome"
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"
task reinstall: [:clean,:install]

View File

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