summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV3n3RiX <venerix@rogentos.ro>2016-03-13 08:22:51 +0000
committerV3n3RiX <venerix@rogentos.ro>2016-03-13 08:22:51 +0000
commit5f120ae34681a55a61ced78d0c482a3ac9375345 (patch)
tree0423eeb378102c77cef80725e6f65b88bfcef912
parent3a7672b4cf8b417bc726f3b7869e23e0af2f083e (diff)
add live user on the fly, no more need to embed it into iso
-rw-r--r--Makefile12
-rw-r--r--kogaionlive.service11
-rwxr-xr-xkogaionlive.sh38
3 files changed, 51 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 0ac7814..dec3f65 100644
--- a/Makefile
+++ b/Makefile
@@ -19,14 +19,6 @@ install:
for d in $(SUBDIRS); do $(MAKE) -C $$d install; done
install -d $(DESTDIR)/$(LIBEXECDIR)
-
- install -d $(DESTDIR)/$(SBINDIR)
- install -d $(DESTDIR)/$(BINDIR)
-
- install -d $(DESTDIR)/$(USBINDIR)
-
- install -d $(DESTDIR)/$(UBINDIR)
-
- install -d $(DESTDIR)/$(SYSCONFDIR)/kogaion
-
+ install -m 0755 kogaionlive.sh $(DESTDIR)/$(LIBEXECDIR)/
install -d $(DESTDIR)/$(SYSTEMD_UNITDIR)/
+ install -m 0644 kogaionlive.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/
diff --git a/kogaionlive.service b/kogaionlive.service
new file mode 100644
index 0000000..268b43c
--- /dev/null
+++ b/kogaionlive.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Kogaion live user setup
+Before=display-manager.service getty.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/kogaionlive.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/kogaionlive.sh b/kogaionlive.sh
new file mode 100755
index 0000000..7aaa6b6
--- /dev/null
+++ b/kogaionlive.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+export local liveuser="kogaion"
+
+checkroot () {
+ if [[ "$(whoami)" != root ]] ; then
+ echo ""
+ echo "You're not root?...No cookies for you, go away !!!"
+ echo ""
+ exit 1
+ fi
+}
+
+kogaion_add_live_user() {
+ /usr/sbin/useradd -u 10000 -g 100 -o -m -s /bin/bash "$liveuser" > /dev/null 2>&1
+}
+
+kogaion_live_user_groups() {
+ for group in tty disk lp wheel uucp console audio cdrom tape video cdrw usb plugdev messagebus portage ; do
+ gpasswd -a "$liveuser" "$group" > /dev/null 2>&1
+ done
+}
+
+kogaion_live_user_password () {
+ /usr/bin/passwd --delete "$liveuser" > /dev/null 2>&1
+}
+
+main () {
+ if checkroot ; then
+ kogaion_add_live_user
+ kogaion_live_user_groups
+ kogaion_live_user_password
+ fi
+}
+
+main
+exit 0
+