diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-05-29 18:39:23 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-05-29 18:39:23 +0100 |
commit | 7075a175aa176edbf57bc396f5571cd836e9879d (patch) | |
tree | 440c12f7b54a6093f1a0ef42d4156f0c5e340b66 | |
parent | 27e91ccadc027a352548386b639aa5b475dedcf7 (diff) |
add openrc support
-rw-r--r-- | Makefile | 6 | ||||
-rwxr-xr-x | redcorelive-openrc.sh | 60 | ||||
-rwxr-xr-x | redcorelive-systemd.sh (renamed from redcorelive.sh) | 0 | ||||
-rw-r--r-- | redcorelive.initd | 14 |
4 files changed, 79 insertions, 1 deletions
@@ -8,6 +8,7 @@ BINDIR ?= /bin LIBEXECDIR ?= /usr/libexec SYSCONFDIR ?= /etc SYSTEMD_UNITDIR ?= $(LIBDIR)/systemd/system +OPENRC_INITDIR ?= $(SYSCONFDIR)/init.d all: for d in $(SUBDIRS); do $(MAKE) -C $$d; done @@ -19,6 +20,9 @@ install: for d in $(SUBDIRS); do $(MAKE) -C $$d install; done install -d $(DESTDIR)/$(LIBEXECDIR) - install -m 0755 redcorelive.sh $(DESTDIR)/$(LIBEXECDIR)/ + install -m 0755 redcorelive-systemd.sh $(DESTDIR)/$(LIBEXECDIR)/ + install -m 0755 redcorelive-openrc.sh $(DESTDIR)/$(LIBEXECDIR)/ install -d $(DESTDIR)/$(SYSTEMD_UNITDIR)/ install -m 0644 redcorelive.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/ + install -d $(DESTDIR)/$(OPENRC_INITDIR)/ + install -m 0755 redcorelive.initd $(DESTDIR)/${OPENRC_INITDIR}/redcorelive diff --git a/redcorelive-openrc.sh b/redcorelive-openrc.sh new file mode 100755 index 0000000..04d8e3d --- /dev/null +++ b/redcorelive-openrc.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +export local liveuser="redcore" + +checkroot() { + if [[ "$(whoami)" != root ]] ; then + echo "No root, no play! Bye bye!" + exit 1 + fi +} + +redcore_is_live() { + if [[ ! -L "/dev/mapper/live-rw" ]] ; then + echo "The system is not running in live mode, aborting!" + exit 1 + fi +} + +redcore_add_live_user() { + /usr/sbin/useradd -u 1000 -g 100 -o -m -s /bin/bash "$liveuser" > /dev/null 2>&1 +} + +redcore_live_user_groups() { + for group in tty disk lp wheel uucp console audio cdrom tape kvm cdemu video cdrw usb plugdev messagebus portage ; do + gpasswd -a "$liveuser" "$group" > /dev/null 2>&1 + done +} + +redcore_live_user_password() { + echo "$liveuser":"$liveuser" | /usr/sbin/chpasswd > /dev/null 2>&1 +} + +redcore_live_locale_switch() { + export local keymap_toset="$(cat /proc/cmdline | cut -d " " -f5 | cut -d "=" -f2)" + export local lang_toset="$(cat /proc/cmdline | cut -d " " -f6 | cut -d "=" -f2)" + if [[ "$lang_toset" != "en_US.utf8" ]] || [[ "$keymap_toset" != "us" ]] ; then + export LANG="$lang_toset" > /dev/null 2>&1 + sed -i "s/keymap=\"us\"/keymap=\"$keymap_toset\"/g" /etc/conf.d/keymaps > /dev/null 2>&1 + /usr/sbin/env-update --no-ldconfig > /dev/null 2>&1 + fi +} + +redcore_live_installer_desktop() { + cp "/usr/share/applications/calamares.desktop" "/home/"$liveuser"/Desktop" + sed -i "s/"Name=Calamares"/"Name=Redcore\ Installer"/g" "/home/"$liveuser"/Desktop/calamares.desktop" + chmod 755 "/home/"$liveuser"/Desktop/calamares.desktop" +} + +main() { + if checkroot && redcore_is_live ; then + redcore_add_live_user + redcore_live_user_groups + redcore_live_user_password + redcore_live_installer_desktop + redcore_live_locale_switch + fi +} + +main +exit 0 diff --git a/redcorelive.sh b/redcorelive-systemd.sh index 212e484..212e484 100755 --- a/redcorelive.sh +++ b/redcorelive-systemd.sh diff --git a/redcorelive.initd b/redcorelive.initd new file mode 100644 index 0000000..21ff75c --- /dev/null +++ b/redcorelive.initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +# Copyright 2017 Redcore Linux Project +# Distributed under the terms of the GNU General Public License v2 + +depend() { + after localmount + before keymaps +} + +start() { + ebegin "Setting up live user" + /usr/libexec/redcorelive-openrc.sh + eend $? +} |