-
Notifications
You must be signed in to change notification settings - Fork 1
/
nix-install-greetd
executable file
·101 lines (86 loc) · 3.2 KB
/
nix-install-greetd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
### Package: nix-install-greetd
### Version: v20210912.2300
### Author: Michael Gan "xmixahlx" [email protected]
### License: GPLv3
### Script Dependencies: (none)
## OVERRIDES
# NIXTOOLS
if [ -z $NIXTOOLSDIR ]; then
NIXTOOLSDIR="`pwd`"
PATH=$NIXTOOLSDIR:$PATH
fi
echo "*** NIXTOOLSDIR selected is $NIXTOOLSDIR."
# INSTALLDEPS
if [ -z $INSTALLDEPS ]; then
INSTALLDEPS=debian
fi
echo "*** INSTALLDEPS selected is $INSTALLDEPS."
# GITBRANCH
if [ -z $GITBRANCH ]; then
GITBRANCH=master
fi
echo "*** GITBRANCH selected is $GITBRANCH."
## VARS
RESDIR=$NIXTOOLSDIR/resources
DEVDIR=$NIXTOOLSDIR/upstream
GITURL=https://git.sr.ht
GITREPO=~kennylevinsen
GITTREE=greetd
PKGDIR=$GITTREE\_$GITBRANCH
## INSTALLDEPS
# Debian Dependencies
if [ $INSTALLDEPS = debian ]; then
sudo apt-get -y install build-essential coreutils libc-bin git meson cargo \
libpam-dev
fi
## PREP
set -e
mkdir -p $DEVDIR
cd $DEVDIR
## GIT
[ -d $PKGDIR ] || git clone --recursive --depth=1 $GITURL/$GITREPO/$GITTREE --branch=$GITBRANCH $PKGDIR
cd $PKGDIR
# Not using -d to retain cargo build directory for faster builds.
git clean -fx
git reset --hard
git pull
git submodule update --init --recursive --depth=1
## BUILD
cargo build --release
## MAN
cd man
for file in *.scd;do scdoc < $file > $file.roff;done
cd ..
## INSTALL
sudo mkdir -p /usr/local/bin
sudo install -m 755 target/release/greetd /usr/local/bin/
sudo install -m 755 target/release/agreety /usr/local/bin/
sudo mkdir -p /usr/local/share/man/man1
sudo mkdir -p /usr/local/share/man/man5
sudo mkdir -p /usr/local/share/man/man7
sudo install -m 755 man/agreety-1.scd.roff /usr/local/share/man/man1/agreety.1
sudo install -m 755 man/greetd-1.scd.roff /usr/local/share/man/man1/greetd.1
sudo install -m 755 man/greetd-5.scd.roff /usr/local/share/man/man5/greetd.5
sudo install -m 755 man/greetd-ipc-7.scd.roff /usr/local/share/man/man7/greetd-ipc.7
sudo mkdir -p /usr/local/etc/systemd/system
sudo install -m 755 greetd.service /usr/local/etc/systemd/system/greetd.service
grep -qw ^greeter /etc/group || sudo useradd -M -G video greeter
sudo mkdir -p /usr/local/etc/greetd
sudo install -m 644 -o greeter -g greeter config.toml /usr/local/etc/greetd/greetd-config.toml
[ -f /usr/local/etc/greetd/environments ] || sudo install -m 644 -o greeter -g greeter $RESDIR/greetd/environments /usr/local/etc/greetd/environments
#[ -L /usr/local/etc/greetd/config.toml ] || sudo ln -s /usr/local/etc/greetd/greetd-config.toml /usr/local/etc/greetd/config.toml
[ -L /etc/greetd ] || sudo ln -s /usr/local/etc/greetd /etc/greetd
[ -L /etc/systemd/system/greetd.service ] || sudo ln -s /usr/local/etc/systemd/system/greetd.service /etc/systemd/system/greetd.service
sudo mkdir -p /usr/local/etc/pam.d
sudo install -m 644 $RESDIR/greetd/pam /usr/local/etc/pam.d/greetd
[ -L /etc/pam.d/greetd ] || sudo ln -s /usr/local/etc/pam.d/greetd /etc/pam.d/greetd
## ALTERNATIVES
if [ $INSTALLDEPS = debian ]; then
sudo update-alternatives --install /usr/local/etc/greetd/config.toml greetd-config /usr/local/etc/greetd/greetd-config.toml 10
sudo update-alternatives --config greetd-config
fi
## INSTRUCTIONS
echo "Enable greetd by: systemctl enable greetd && systemctl start greetd. Note: Your current session will be disrupted."
## EXIT
exit