47 Commits
0.4.5 ... 0.9

Author SHA1 Message Date
186c4cc944 check for neofetch 2020-07-26 16:29:42 +02:00
36b3def4df Merge pull request 'set branding' (#4) from neo into master 2020-07-26 16:27:49 +02:00
bff662b2bb remeove s6 pacman-init dependencies file 2020-07-26 16:26:06 +02:00
6a830fd09e Merge pull request 'pacman-init: make sure /etc/pacman.d/gnupg exists' (#5) from s6-fix into master 2020-03-21 19:49:51 +01:00
53738530d9 add s6.pdf 2020-02-08 22:51:05 +01:00
2008d08da2 update desktop.map 2020-02-08 18:34:02 +01:00
f1a229a2b2 pacman-init: make sure /etc/pacman.d/gnupg exists
Noticed that this directory may not exist so the mount fails.
2020-01-17 22:33:28 -06:00
8163c1574f set branding 2019-12-23 21:23:28 +01:00
61bc0ee372 Merge branch 'master' of gitea.artixlinux.org:artix/live-services 2019-12-12 00:09:34 +01:00
dd34bf3df9 create user early to make autologin work 2019-12-12 00:09:29 +01:00
36614abf6a Add xdg-user-dirs-update --force to catch race condition in
MATE
2019-12-09 17:59:45 +02:00
96cc41dcde remove potable efi helper 2019-11-17 00:48:35 +01:00
b2d2877df9 fix datadir 2019-10-30 19:53:59 +01:00
d051f3f73b Makefile: install s6 2019-10-28 22:19:46 +01:00
90bb86cec1 Merge branch 's6-support-branch' of artix/live-services into master 2019-10-28 22:01:39 +01:00
e9e0e0be8f Create a bundle for artix-live and pacman-init 2019-10-28 15:56:29 -05:00
82e6b1edea Merge branch 's6-support-branch' of artix/live-services into master 2019-10-28 21:36:09 +01:00
bea5c4dfd6 s6 update 2019-10-28 09:22:10 -05:00
a3751e733b rename rc services 2019-10-02 00:53:19 +02:00
88cae232da initial s6 support 2019-10-02 00:31:46 +02:00
3861ade296 update 2019-01-06 03:41:03 +01:00
20401b1e4f util-live: update load_live_config() 2019-01-06 03:39:33 +01:00
a5920b81da clean up 2019-01-03 22:38:07 +01:00
5a1bddf043 start 0.8 2019-01-03 22:30:16 +01:00
c24367f987 * start 0.7
* capitalize glibal vars
2018-10-21 17:32:36 +02:00
0ccfdbfc21 fix readme path 2018-10-07 22:12:02 +02:00
c30cd6999b prepare release 2018-10-07 20:45:11 +02:00
e5b37014d0 try to fix calamares launcher 2018-10-07 14:05:33 +02:00
96ae6855ac desktop-items: fix konversation 2018-10-06 14:18:40 +02:00
22014421b1 fix konversation typo 2018-10-05 21:42:29 +02:00
ccebe7ecf3 symlink docs to localized desktop dir 2018-10-05 10:01:06 +02:00
7557a84a7d clean up; remove old code 2018-10-05 00:10:04 +02:00
712774d585 create desktop launchers 2018-10-04 23:53:55 +02:00
ef98a333ca rm netinstall 2018-10-02 22:18:26 +02:00
udeved
7727ce662e fix runit live sym 2018-05-14 16:59:29 +00:00
udeved
b841184cb2 fix runit live sym 2018-05-14 16:56:44 +00:00
udeved
528b3091c6 Merge branch 'master' of github.com:artix-linux/live-services 2018-05-14 16:50:45 +00:00
udeved
ffb4f4ba98 update runit live for runit-rc 2018-05-14 16:50:22 +00:00
udeved
64fe174eba update runit live for runit-rc 2018-05-14 16:40:37 +00:00
udeved
dc955770b3 makefile: small fix 2018-04-14 18:40:06 +02:00
udeved
004760e16a mkaefile: fix datadir path 2018-04-14 16:48:18 +02:00
bb1f0fbdc0 reflect the new runit service directory 2018-04-14 08:49:23 +07:00
udeved
f879bf8965 start 0.5 2018-04-11 21:12:10 +02:00
udeved
7e93c77b9a makefile: fix uninstall 2018-04-11 19:24:17 +02:00
8832d21deb change pacman-init directory to reflect new scheme 2018-04-09 10:58:20 +07:00
189ceeb7e7 Move pacman-init to a service on its own 2018-02-17 13:12:39 +07:00
9c6b20fea3 Fix typo 2018-02-17 12:00:58 +07:00
24 changed files with 233 additions and 296 deletions

View File

@@ -1,6 +1,6 @@
BSD 2-Clause License BSD 2-Clause License
Copyright (c) 2017, Cromnix GNU/Linux Copyright (c) 2018-2019, Artix Linux
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

108
Makefile
View File

@@ -1,7 +1,17 @@
Version=0.1 VERSION = 0.8
PKG = live-services
TOOLS = artools
PREFIX = /usr/local
SYSCONFDIR = /etc SYSCONFDIR = /etc
PREFIX ?= /usr
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
DATADIR = $(PREFIX)/share
FMODE = -m0644
DMODE = -dm0755
BMODE = -m0755
BIN = \ BIN = \
bin/artix-live bin/artix-live
@@ -17,76 +27,72 @@ RC = \
data/rc/pacman-init \ data/rc/pacman-init \
data/rc/artix-live data/rc/artix-live
RUNIT_SV = $(wildcard data/runit/*.sh) RUNIT_SVD = \
data/runit/live
GRUB_DEFAULT = \ RUNIT_SV = \
data/grub2-portable-efi data/runit/pacman-init.run
GRUB_D = \ S6_LIVE = \
data/99_zzz-portable-efi $(wildcard data/s6/artix-live/*)
all: $(BIN) $(RC) $(RUNIT_SV) $(XBIN) ${GRUB_D} S6_PI = \
$(wildcard data/s6/pacman-init/*)
edit = sed -e "s|@datadir[@]|$(DESTDIR)$(PREFIX)/share/artools|g" \ S6_BUNDLE = \
-e "s|@sysconfdir[@]|$(DESTDIR)$(SYSCONFDIR)/artools|g" \ $(wildcard data/s6/live/*)
-e "s|@libdir[@]|$(DESTDIR)$(PREFIX)/lib/artools|g"
%: %.in Makefile S6_SV = \
@echo "GEN $@" data/s6/pacman-init.run
@$(RM) "$@"
@m4 -P $@.in | $(edit) >$@ XDG = $(wildcard data/*.desktop)
@chmod a-w "$@"
@chmod +x "$@" XBIN = bin/desktop-items
clean:
rm -f $(BIN) $(RC) ${GRUB_D}
install_base: install_base:
install -dm0755 $(DESTDIR)$(PREFIX)/bin install $(DMODE) $(DESTDIR)$(BINDIR)
install -m0755 ${BIN} $(DESTDIR)$(PREFIX)/bin install $(BMODE) $(BIN) $(DESTDIR)$(BINDIR)
install -dm0755 $(DESTDIR)$(PREFIX)/lib/artools install $(DMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install -m0644 ${LIBS} $(DESTDIR)$(PREFIX)/lib/artools install $(FMODE) $(LIBS) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install -dm0755 $(DESTDIR)$(PREFIX)/share/artools install $(DMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)
install -m0644 ${SHARED} $(DESTDIR)$(PREFIX)/share/artools install $(FMODE) $(SHARED) $(DESTDIR)$(DATADIR)/$(TOOLS)
install_rc: install_rc:
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/init.d install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/init.d
install -m0755 ${RC} $(DESTDIR)$(SYSCONFDIR)/init.d install $(BMODE) $(RC) $(DESTDIR)$(SYSCONFDIR)/init.d
install_runit: install_runit:
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/runit/core-services install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/rc/sysinit
install -m0755 ${RUNIT_SV} $(DESTDIR)$(SYSCONFDIR)/runit/core-services install $(DMODE) $(DESTDIR)$(LIBDIR)/rc/sv.d
install_portable_efi: install $(BMODE) $(RUNIT_SVD) $(DESTDIR)$(LIBDIR)/rc/sv.d
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/default ln -sf $(LIBDIR)/rc/sv.d/live $(DESTDIR)$(SYSCONFDIR)/rc/sysinit/98-live
install -m0755 $(GRUB_DEFAULT) $(DESTDIR)$(SYSCONFDIR)/default
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/grub.d install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/runit/sv/pacman-init
install -m0755 $(GRUB_D) $(DESTDIR)$(SYSCONFDIR)/grub.d install $(BMODE) $(RUNIT_SV) $(DESTDIR)$(SYSCONFDIR)/runit/sv/pacman-init/run
uninstall_base: install_s6:
for f in ${BIN}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv
for f in ${SHARED}; do rm -f $(DESTDIR)$(PREFIX)/share/artools/$$f; done
for f in ${LIBS}; do rm -f $(DESTDIR)$(PREFIX)/lib/artools/$$f; done
uninstall_portable_efi: install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/pacman-init
for f in ${GRUB_DEFAULT}; do rm -f $(DESTDIR)$(SYSCONFDIR)/default/$$f; done install $(BMODE) $(S6_PI) $(DESTDIR)$(SYSCONFDIR)/s6/sv/pacman-init/
for f in ${GRUB_D}; do rm -f $(DESTDIR)$(SYSCONFDIR)/grub.d/$$f; done
uninstall_rc: install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/artix-live
for f in ${RC}; do rm -f $(DESTDIR)$(SYSCONFDIR)/init.d/$$f; done install $(BMODE) $(S6_LIVE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/artix-live/
uninstall_runit: install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/live
for f in ${RUNIT_SV}; do rm -f $(DESTDIR)$(SYSCONFDIR)/runit/sv/$$f; done install $(BMODE) $(S6_BUNDLE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/live/
install: install_base install_rc install_portable_efi install_xdg:
install -dm0755 $(DESTDIR)$(PREFIX)/bin
install -m0755 ${XBIN} $(DESTDIR)$(PREFIX)/bin
uninstall: uninstall_base uninstall_rc uninstall_runit uninstall_portable_efi install -dm0755 $(DESTDIR)$(SYSCONFDIR)/skel/.config/autostart
install -m0755 ${XDG} $(DESTDIR)$(SYSCONFDIR)/skel/.config/autostart
dist: install: install_base install_rc install_runit install_s6 install_xdg
git archive --format=tar --prefix=live-services-$(Version)/ $(Version) | gzip -9 > live-services-$(Version).tar.gz
gpg --detach-sign --use-agent live-services-$(Version).tar.gz
.PHONY: all clean install uninstall dist .PHONY: install

36
bin/artix-live Normal file
View File

@@ -0,0 +1,36 @@
#!/bin/sh
LOGFILE='/var/log/artix-live.log'
. /usr/lib/artools/util-live.sh
load_live_config "/etc/artools/live.conf" || load_live_config "/usr/share/artools/live.conf"
CONSOLEFONT="$(kernel_cmdline vconsole.font)"
CONSOLEMAP="$(kernel_cmdline vconsole.font.map)"
echo "Got consolefont ${CONSOLEFONT} and consolemap ${CONSOLEMAP}" >> "${LOGFILE}"
# Activate swap
configure_swap
echo "Activated swap and added to fstab" >> "${LOGFILE}"
configure_language
echo "Finished localization" >> "${LOGFILE}"
configure_user 'root'
echo "Configured root user" >> "${LOGFILE}"
configure_user "${USER_NAME}"
echo "Created user ${USER_NAME} with password ${PASSWORD}" >> "${LOGFILE}"
detect_desktop_env
echo "Detected ${DEFAULT_DESKTOP_EXECUTABLE} ${DEFAULT_DESKTOP_FILE}" >> "${LOGFILE}"
configure_accountsservice "${USER_NAME}"
echo "Configured accountsservice" >> "${LOGFILE}"
configure_displaymanager
echo "Configured displaymanager" >> "${LOGFILE}"
configure_branding
echo "Configured branding" >> "${LOGFILE}"

View File

@@ -1,62 +0,0 @@
#!/bin/sh
LIBDIR='@libdir@'
DATADIR='@datadir@'
SYSCONFDIR='@sysconfdir@'
LOGFILE='/var/log/artix-live.log'
export LC_MESSAGES=C
export LANG=C
livetimer=$(date +%s%3N)
[[ -r ${LIBDIR}/util-live.sh ]] && source ${LIBDIR}/util-live.sh
load_live_config "${SYSCONFDIR}/live.conf" || load_live_config "${DATADIR}/live.conf"
livetimer=$(get_timer_ms)
detect_desktop_env
echo "Detected ${default_desktop_executable} ${default_desktop_file}: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
CONSOLEFONT="$(kernel_cmdline vconsole.font)"
CONSOLEMAP="$(kernel_cmdline vconsole.font.map)"
arch=$(uname -m)
echo "Got consolefont and arch $arch: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
# Activate swap
livetimer=$(get_timer_ms)
configure_swap
echo "Activated swap and added to fstab: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_language
echo "Finished localization: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_user
echo "Created user ${username} with password ${password}: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_sudoers_d
echo "Configured sudoers: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
# livetimer=$(get_timer_ms)
# configure_machine_id
# echo "Configured machine-id: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_accountsservice "${username}"
echo "Configured accountsservice: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_displaymanager
echo "Configured displaymanager: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_calamares
echo "Configured calamares netinstall ${netinstall} $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_user_root /
echo "Configured root user: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"

34
bin/desktop-items Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/sh
# Ensure the user directories are created, some DEs (MATE)
# create them after autostart scripts are run
xdg-user-dirs-update --force
xdg=$(xdg-user-dir DESKTOP)
src=/usr/share/applications
# if [[ -f $src/org.kde.konversation.desktop ]]; then
# install -m644 $src/org.kde.konversation.desktop \
# $xdg/org.kde.konversation.desktop
# fi
# if [[ -f /usr/bin/calamares ]]; then
# cp $src/calamares.desktop \
# $xdg/calamares.desktop
# fi
docs=/usr/share/doc/artix
for f in {Configuration,Troubleshooting}.pdf;do
ln -s $docs/$f $xdg/$f
done
if [[ -d /run/openrc ]];then
ln -s $docs/OpenRC.pdf $xdg/OpenRC.pdf
elif [[ -d /run/runit ]];then
ln -s $docs/Runit.pdf $xdg/Runit.pdf
else
ln -s $docs/S6.pdf $xdg/S6.pdf
fi
echo "live session details: /var/log/artix-live.log" > $xdg/README.txt

View File

@@ -1,49 +0,0 @@
#!/bin/sh
# grub-mkconfig helper script.
#
# Copyright © 2014 Niall Walsh <niallwalsh@celtux.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
set -e
AT_EFI_STANDALONE=""
AT_EFI_PORTABLE_PATH="/boot/efi/EFI/BOOT"
# override tool behaviour through /etc/default/grub2-fll-standalone
if [ -r /etc/default/grub2-portable-efi ]; then
. /etc/default/grub2-portable-efi
fi
patt='[[:space:]]-o[[:space:]]\+/boot/grub/grub.cfg'
# do nothing if disabled or grub-mkconfig is generating /boot/grub/grub.cfg
( [ "${AT_EFI_STANDALONE}" != "disable" ] && \
ps x | grep 'grub-mkconfig[[:space:]]' | grep -q -e "${patt}[[:space:]]" -e "${patt}$" ) || exit
beeb="${AT_EFI_PORTABLE_PATH}"
if [ -e "${beeb}" ]; then
# do not do anything to a beeb we didn't create
[ ! -e "${beeb}/fullstory" ] && exit
else
# create beeb and mark it as ours
mkdir -p "${beeb}"
touch "${beeb}/fullstory"
fi
for platform in i386-efi x86_64-efi ; do
filename="bootx64"
[ "${platform}" = "i386-efi" ] && filename="bootia32"
[ -e /usr/lib/grub/${platform} ] && grub-mkstandalone \
-o ${beeb}/${filename}.efi --compress=xz -O ${platform} \
/boot/grub/grub.cfg=/boot/grub/grub.cfg.new 2>&1 > /dev/null
done

View File

@@ -4,15 +4,15 @@ jwm:jwm
i3:i3 i3:i3
fluxbox:startfluxbox fluxbox:startfluxbox
pekwm:pekwm pekwm:pekwm
plasma:startkde
gnome:gnome-session
xfce:startxfce4
cinnamon:cinnamon-session-cinnamon
mate:mate-session
enlightenment:enlightenment_start enlightenment:enlightenment_start
Lumina-DE:start-lumina-desktop
LXDE:lxsession LXDE:lxsession
lxqt:lxqt-session lxqt:lxqt-session
pantheon:pantheon-session pantheon:pantheon-session
budgie-desktop:budgie-desktop budgie-desktop:budgie-desktop
deepin:startdde deepin:startdde
Lumina-DE:start-lumina-desktop mate:mate-session
cinnamon:cinnamon-session-cinnamon
xfce:startxfce4
gnome:gnome-session
plasma:startkde

View File

@@ -1,15 +0,0 @@
# Defaults for grub2-portable-efi update-grub helper
# sourced by grub2's update-grub
# installed at /etc/default/grub2-portable-efi by the maintainer scripts
#
# This is a POSIX shell fragment
#
# specify is this should be disabled (set to "disable")
# default:
#AT_EFI_STANDALONE=""
# specify where to install the portable efi
# default: /boot/efi/EFI/BOOT
#AT_EFI_PORTABLE_PATH="/boot/efi/EFI/BOOT"

View File

@@ -1,20 +1,13 @@
# live session configuration # live session configuration
# autologin # autologin
autologin=true AUTOLOGIN=true
# live username # live username
username=artix USER_NAME=artix
# live password # live password
password=artix PASSWORD=artix
# live group membership # live group membership
addgroups='video,power,disk,storage,optical,network,lp,scanner,wheel' ADDGROUPS='video,power,cdrom,network,lp,scanner,wheel'
# default_desktop_file
default_desktop_file=lxqt
# default_desktop_executable
default_desktop_executable=lxqt-session

View File

@@ -1,5 +1,5 @@
#!/usr/bin/openrc-run #!/usr/bin/openrc-run
# Copyright 2015 artoo (artoo@cromnix.org) # Copyright 2019 artoo (artoo@artixlinux.org)
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
target_dir=/etc/pacman.d/gnupg target_dir=/etc/pacman.d/gnupg

View File

@@ -1,2 +0,0 @@
msg "Initializing artix-live script"
artix-live

View File

@@ -1,6 +0,0 @@
msg "Mounting temporary gnupg directory"
mount -t tmpfs -o size=10M,mode=0755 tmpfs /etc/pacman.d/gnupg
msg "Initializing pacman"
pacman-key --init
pacman-key --populate archlinux-artix

15
data/runit/live Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
. /usr/lib/rc/functions
case "$1" in
start)
stat_busy "Initializing artix live system"
artix-live #|| stat_die
add_daemon live
stat_done
;;
*)
echo "usage: $0 {start}"
;;
esac

View File

@@ -0,0 +1,5 @@
#!/bin/sh
mount -t tmpfs -o size=10M,mode=0755 tmpfs /etc/pacman.d/gnupg
pacman-key --init 1>&2
pacman-key --populate archlinux artix 1>&2
exec chpst -b pacman-init pause

1
data/s6/artix-live/type Normal file
View File

@@ -0,0 +1 @@
oneshot

3
data/s6/artix-live/up Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/execlineb -P
if { echo "Initializing artix live system" }
foreground { /usr/bin/artix-live }

2
data/s6/live/contents Normal file
View File

@@ -0,0 +1,2 @@
artix-live
pacman-init

1
data/s6/live/type Normal file
View File

@@ -0,0 +1 @@
bundle

2
data/s6/pacman-init/down Normal file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/execline -P
umount -l /etc/pacman.d/gnupg

1
data/s6/pacman-init/type Normal file
View File

@@ -0,0 +1 @@
oneshot

6
data/s6/pacman-init/up Normal file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/execlineb -P
foreground { mkdir -p /etc/pacman.d/gnupg }
foreground { mount -t tmpfs -o size=10M,mode=0755 tmpfs /etc/pacman.d/gnupg }
fdmove -c 2 1
foreground { pacman-key --init }
foreground { pacman-key --populate archlinux artix }

View File

@@ -9,6 +9,9 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
export LC_MESSAGES=C
export LANG=C
kernel_cmdline(){ kernel_cmdline(){
for param in $(cat /proc/cmdline); do for param in $(cat /proc/cmdline); do
case "${param}" in case "${param}" in
@@ -33,43 +36,28 @@ get_tz(){
echo $(kernel_cmdline tz) echo $(kernel_cmdline tz)
} }
get_cal_mode(){
echo $(kernel_cmdline netinstall)
}
get_timer_ms(){
echo $(date +%s%3N)
}
# $1: start timer
elapsed_time_ms(){
echo $(echo $1 $(get_timer_ms) | awk '{ printf "%0.3f",($2-$1)/1000 }')
}
load_live_config(){ load_live_config(){
[[ -f $1 ]] || return 1 [[ -f $1 ]] || return 1
live_conf="$1" local live_conf="$1"
[[ -r ${live_conf} ]] && source ${live_conf} [[ -r ${live_conf} ]] && source ${live_conf}
[[ -z ${autologin} ]] && autologin=true AUTOLOGIN=${AUTOLOGIN:-true}
[[ -z ${username} ]] && username="artix" USER_NAME=${USER_NAME:-"artix"}
[[ -z ${password} ]] && password="artix" PASSWORD=${PASSWORD:-"artix"}
[[ -z ${addgroups} ]] && addgroups="video,power,storage,optical,network,lp,scanner,wheel,users,audio" ADDGROUPS=${ADDGROUPS:-"video,power,cdrom,network,lp,scanner,wheel,users,log"}
echo "Loaded ${live_conf}: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
return 0 return 0
} }
is_valid_de(){ is_valid_de(){
if [[ ${default_desktop_executable} != "none" ]] && \ if [[ ${DEFAULT_DESKTOP_EXECUTABLE} != "none" ]] && \
[[ ${default_desktop_file} != "none" ]]; then [[ ${DEFAULT_DESKTOP_FILE} != "none" ]]; then
return 0 return 0
else else
return 1 return 1
@@ -78,21 +66,21 @@ is_valid_de(){
load_desktop_map(){ load_desktop_map(){
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g" \ local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g" \
file=${DATADIR}/desktop.map file=/usr/share/artools/desktop.map
local desktop_map=$(sed "$_com_rm" "$file" | sed "$_space" | sed "$_clean") local desktop_map=$(sed "$_com_rm" "$file" | sed "$_space" | sed "$_clean")
echo ${desktop_map} echo ${desktop_map}
} }
detect_desktop_env(){ detect_desktop_env(){
local xs=/usr/share/xsessions ex=/usr/bin key val map=( $(load_desktop_map) ) local key val map=( $(load_desktop_map) )
default_desktop_file="none" DEFAULT_DESKTOP_FILE="none"
default_desktop_executable="none" DEFAULT_DESKTOP_EXECUTABLE="none"
for item in "${map[@]}";do for item in "${map[@]}";do
key=${item%:*} key=${item%:*}
val=${item#*:} val=${item#*:}
if [[ -f $xs/$key.desktop ]] && [[ -f $ex/$val ]];then if [[ -f /usr/share/xsessions/$key.desktop ]] && [[ -f /usr/bin/$val ]];then
default_desktop_file="$key" DEFAULT_DESKTOP_FILE="$key"
default_desktop_executable="$val" DEFAULT_DESKTOP_EXECUTABLE="$val"
fi fi
done done
} }
@@ -101,7 +89,7 @@ configure_accountsservice(){
local path=/var/lib/AccountsService/users local path=/var/lib/AccountsService/users
if [ -d "${path}" ] ; then if [ -d "${path}" ] ; then
echo "[User]" > ${path}/$1 echo "[User]" > ${path}/$1
echo "XSession=${default_desktop_file}" >> ${path}/$1 echo "XSession=${DEFAULT_DESKTOP_FILE}" >> ${path}/$1
if [[ -f "/var/lib/AccountsService/icons/$1.png" ]];then if [[ -f "/var/lib/AccountsService/icons/$1.png" ]];then
echo "Icon=/var/lib/AccountsService/icons/$1.png" >> ${path}/$1 echo "Icon=/var/lib/AccountsService/icons/$1.png" >> ${path}/$1
fi fi
@@ -122,78 +110,65 @@ configure_accountsservice(){
done done
} }
set_lightdm_vt(){
sed -i -e 's/^.*minimum-vt=.*/minimum-vt=7/' /etc/lightdm/lightdm.conf
}
configure_displaymanager(){ configure_displaymanager(){
# Try to detect desktop environment # Try to detect desktop environment
# Configure display manager # Configure display manager
if [[ -f /usr/bin/lightdm ]];then if [[ -f /usr/bin/lightdm ]];then
groupadd -r autologin groupadd -r autologin
set_lightdm_vt sed -i -e 's/^.*minimum-vt=.*/minimum-vt=7/' /etc/lightdm/lightdm.conf
set_lightdm_greeter set_lightdm_greeter
if $(is_valid_de); then if $(is_valid_de); then
sed -i -e "s/^.*user-session=.*/user-session=$default_desktop_file/" /etc/lightdm/lightdm.conf sed -i -e "s/^.*user-session=.*/user-session=$DEFAULT_DESKTOP_FILE/" /etc/lightdm/lightdm.conf
fi fi
if ${autologin};then if ${AUTOLOGIN};then
gpasswd -a ${username} autologin &> /dev/null gpasswd -a ${USER_NAME} autologin &> /dev/null
sed -i -e "s/^.*autologin-user=.*/autologin-user=${username}/" /etc/lightdm/lightdm.conf sed -i -e "s/^.*autologin-user=.*/autologin-user=${USER_NAME}/" /etc/lightdm/lightdm.conf
sed -i -e "s/^.*autologin-user-timeout=.*/autologin-user-timeout=0/" /etc/lightdm/lightdm.conf sed -i -e "s/^.*autologin-user-timeout=.*/autologin-user-timeout=0/" /etc/lightdm/lightdm.conf
sed -i -e "s/^.*pam-autologin-service=.*/pam-autologin-service=lightdm-autologin/" /etc/lightdm/lightdm.conf sed -i -e "s/^.*pam-autologin-service=.*/pam-autologin-service=lightdm-autologin/" /etc/lightdm/lightdm.conf
fi fi
elif [[ -f /usr/bin/gdm ]];then elif [[ -f /usr/bin/gdm ]];then
configure_accountsservice "gdm" configure_accountsservice "gdm"
if ${autologin};then if ${AUTOLOGIN};then
sed -i -e "s/\[daemon\]/\[daemon\]\nAutomaticLogin=${username}\nAutomaticLoginEnable=True/" /etc/gdm/custom.conf sed -i -e "s/\[daemon\]/\[daemon\]\nAutomaticLogin=${USER_NAME}\nAutomaticLoginEnable=True/" /etc/gdm/custom.conf
fi fi
elif [[ -f /usr/bin/sddm ]];then elif [[ -f /usr/bin/sddm ]];then
if $(is_valid_de); then if $(is_valid_de); then
sed -i -e "s|^Session=.*|Session=$default_desktop_file.desktop|" /etc/sddm.conf sed -i -e "s|^Session=.*|Session=$DEFAULT_DESKTOP_FILE.desktop|" /etc/sddm.conf
fi fi
if ${autologin};then if ${AUTOLOGIN};then
sed -i -e "s|^User=.*|User=${username}|" /etc/sddm.conf sed -i -e "s|^User=.*|User=${USER_NAME}|" /etc/sddm.conf
fi fi
elif [[ -f /usr/bin/lxdm ]];then elif [[ -f /usr/bin/lxdm ]];then
if $(is_valid_de); then if $(is_valid_de); then
sed -i -e "s|^.*session=.*|session=/usr/bin/$default_desktop_executable|" /etc/lxdm/lxdm.conf sed -i -e "s|^.*session=.*|session=/usr/bin/${DEFAULT_DESKTOP_EXECUTABLE}|" /etc/lxdm/lxdm.conf
fi fi
if ${autologin};then if ${AUTOLOGIN};then
sed -i -e "s/^.*autologin=.*/autologin=${username}/" /etc/lxdm/lxdm.conf sed -i -e "s/^.*autologin=.*/autologin=${USER_NAME}/" /etc/lxdm/lxdm.conf
fi fi
fi fi
} }
gen_pw(){ gen_pw(){
echo $(perl -e 'print crypt($ARGV[0], "password")' ${password}) echo $(perl -e 'print crypt($ARGV[0], "password")' ${PASSWORD})
}
configure_user(){
# set up user and password
if [[ -n ${password} ]];then
useradd -m -G ${addgroups} -p $(gen_pw) -s /bin/bash ${username}
else
useradd -m -G ${addgroups} -s /bin/bash ${username}
fi
} }
find_legacy_keymap(){ find_legacy_keymap(){
local file="${DATADIR}/kbd-model.map" local file="/usr/share/artools/kbd-model.map" kt="$1"
while read -r line || [[ -n $line ]]; do while read -r line || [[ -n $line ]]; do
if [[ -z $line ]] || [[ $line == \#* ]]; then if [[ -z $line ]] || [[ $line == \#* ]]; then
continue continue
fi fi
mapping=( $line ); # parses columns local mapping=( $line ); # parses columns
if [[ ${#mapping[@]} != 5 ]]; then if [[ ${#mapping[@]} != 5 ]]; then
continue continue
fi fi
if [[ "${keytable}" != "${mapping[0]}" ]]; then if [[ "$kt" != "${mapping[0]}" ]]; then
continue continue
fi fi
if [[ "${mapping[3]}" = "-" ]]; then if [[ "${mapping[3]}" == "-" ]]; then
mapping[3]="" mapping[3]=""
fi fi
@@ -212,12 +187,13 @@ write_x11_config(){
local X11_MODEL="pc105" local X11_MODEL="pc105"
local X11_VARIANT="" local X11_VARIANT=""
local X11_OPTIONS="terminate:ctrl_alt_bksp" local X11_OPTIONS="terminate:ctrl_alt_bksp"
local kt="$1"
find_legacy_keymap find_legacy_keymap "$kt"
# layout not found, use KBLAYOUT # layout not found, use KBLAYOUT
if [[ -z "$X11_LAYOUT" ]]; then if [[ -z "$X11_LAYOUT" ]]; then
X11_LAYOUT="${keytable}" X11_LAYOUT="$kt"
fi fi
# create X11 keyboard layout config # create X11 keyboard layout config
@@ -239,17 +215,11 @@ write_x11_config(){
configure_language(){ configure_language(){
# hack to be able to set the locale on bootup # hack to be able to set the locale on bootup
local lang=$(get_lang) local lang=$(get_lang)
keytable=$(get_keytable) local keytable=$(get_keytable)
local timezone=$(get_tz) local timezone=$(get_tz)
# Fallback
# [[ -z "${lang}" ]] && lang="en_US"
# [[ -z "${keytable}" ]] && keytable="us"
# [[ -z "${timezone}" ]] && timezone="Etc/UTC"
sed -e "s/#${lang}.UTF-8/${lang}.UTF-8/" -i /etc/locale.gen sed -e "s/#${lang}.UTF-8/${lang}.UTF-8/" -i /etc/locale.gen
# echo "LANG=${lang}.UTF-8" >> /etc/environment
if [[ -d /run/openrc ]]; then if [[ -d /run/openrc ]]; then
sed -i "s/keymap=.*/keymap=\"${keytable}\"/" /etc/conf.d/keymaps sed -i "s/keymap=.*/keymap=\"${keytable}\"/" /etc/conf.d/keymaps
fi fi
@@ -257,7 +227,7 @@ configure_language(){
echo "LANG=${lang}.UTF-8" > /etc/locale.conf echo "LANG=${lang}.UTF-8" > /etc/locale.conf
ln -sf /usr/share/zoneinfo/${timezone} /etc/localtime ln -sf /usr/share/zoneinfo/${timezone} /etc/localtime
write_x11_config write_x11_config "${keytable}"
loadkeys "${keytable}" loadkeys "${keytable}"
@@ -267,23 +237,6 @@ configure_language(){
echo "Configured timezone: ${timezone}" >> "${LOGFILE}" echo "Configured timezone: ${timezone}" >> "${LOGFILE}"
} }
configure_calamares(){
if [[ -f /usr/bin/calamares ]];then
netinstall=$(get_cal_mode)
if [[ "${netinstall}" == 'no' ]];then
sed -e "/- netinstall/d" \
-e "s|- chrootcfg|- unpackfs|" -i /etc/calamares/settings.conf
sed -e '$ d' -i /etc/calamares/modules/welcome.conf
fi
fi
}
configure_sudoers_d(){
echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/g_wheel
echo "root ALL=(ALL) ALL" > /etc/sudoers.d/u_root
}
configure_swap(){ configure_swap(){
local swapdev="$(fdisk -l 2>/dev/null | grep swap | cut -d' ' -f1)" local swapdev="$(fdisk -l 2>/dev/null | grep swap | cut -d' ' -f1)"
if [ -e "${swapdev}" ]; then if [ -e "${swapdev}" ]; then
@@ -291,8 +244,21 @@ configure_swap(){
fi fi
} }
configure_user_root(){ configure_branding(){
# set up root password if [[ -f /usr/bin/neofetch ]]; then
echo "root:${password}" | chroot $1 chpasswd neofetch >| /etc/issue
cp /etc/skel/.{bash_profile,bashrc,bash_logout} /root/ fi
}
configure_user(){
local user="$1"
if [[ "$user" == 'root' ]];then
echo "root:${PASSWORD}" | chroot / chpasswd
cp /etc/skel/.{bash_profile,bashrc,bash_logout} /root/
else
local args=(-m -G ${ADDGROUPS} -s /bin/bash $user)
# set up user and password
[[ -n ${PASSWORD} ]] && args+=(-p $(gen_pw))
useradd "${args[@]}"
fi
} }