18 Commits
0.7 ... 0.8.6

Author SHA1 Message Date
53738530d9 add s6.pdf 2020-02-08 22:51:05 +01:00
2008d08da2 update desktop.map 2020-02-08 18:34:02 +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
21 changed files with 120 additions and 218 deletions

View File

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

View File

@@ -1,12 +1,10 @@
VERSION = 0.7
VERSION = 0.8
PKG = live-services
TOOLS = artools
SYSCONFDIR = /etc
ifdef PREFIX
PREFIX = /usr/local
endif
PREFIX ?= /usr
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
DATADIR = $(PREFIX)/share
@@ -14,10 +12,6 @@ DATADIR = $(PREFIX)/share
FMODE = -m0644
DMODE = -dm0755
BMODE = -m0755
RM = rm -f
M4 = m4 -P
CHAW = chmod a-w
CHX = chmod +x
BIN = \
bin/artix-live
@@ -39,31 +33,22 @@ RUNIT_SVD = \
RUNIT_SV = \
data/runit/pacman-init.run
GRUB_DEFAULT = \
data/grub2-portable-efi
S6_LIVE = \
$(wildcard data/s6/artix-live/*)
GRUB_D = \
data/99_zzz-portable-efi
S6_PI = \
$(wildcard data/s6/pacman-init/*)
S6_BUNDLE = \
$(wildcard data/s6/live/*)
S6_SV = \
data/s6/pacman-init.run
XDG = $(wildcard data/*.desktop)
XBIN = bin/desktop-items
all: $(BIN) $(RC) $(RUNIT_SV) $(XBIN) $(GRUB_D)
EDIT = sed -e "s|@datadir[@]|$(DATADIR)/$(TOOLS)|g" \
-e "s|@sysconfdir[@]|$(SYSCONFDIR)/$(TOOLS)|g" \
-e "s|@libdir[@]|$(LIBDIR)/$(TOOLS)|g"
%: %.in Makefile
@echo "GEN $@"
@$(RM) "$@"
@$(M4) $@.in | $(EDIT) >$@
@$(CHAW) "$@"
@$(CHX) "$@"
clean:
$(RM) $(BIN) $(RC) $(GRUB_D)
install_base:
install $(DMODE) $(DESTDIR)$(BINDIR)
@@ -83,18 +68,23 @@ install_runit:
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/rc/sysinit
install $(DMODE) $(DESTDIR)$(LIBDIR)/rc/sv.d
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/runit/sv/pacman-init
install $(BMODE) $(RUNIT_SVD) $(DESTDIR)$(LIBDIR)/rc/sv.d
ln -sf $(LIBDIR)/rc/sv.d/live $(DESTDIR)$(SYSCONFDIR)/rc/sysinit/98-live
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/runit/sv/pacman-init
install $(BMODE) $(RUNIT_SV) $(DESTDIR)$(SYSCONFDIR)/runit/sv/pacman-init/run
install_portable_efi:
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/default
install $(BMODE) $(GRUB_DEFAULT) $(DESTDIR)$(SYSCONFDIR)/default
install_s6:
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/grub.d
install $(BMODE) $(GRUB_D) $(DESTDIR)$(SYSCONFDIR)/grub.d
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/pacman-init
install $(BMODE) $(S6_PI) $(DESTDIR)$(SYSCONFDIR)/s6/sv/pacman-init/
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/artix-live
install $(BMODE) $(S6_LIVE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/artix-live/
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/live
install $(BMODE) $(S6_BUNDLE) $(DESTDIR)$(SYSCONFDIR)/s6/sv/live/
install_xdg:
install -dm0755 $(DESTDIR)$(PREFIX)/bin
@@ -103,6 +93,6 @@ install_xdg:
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/skel/.config/autostart
install -m0755 ${XDG} $(DESTDIR)$(SYSCONFDIR)/skel/.config/autostart
install: install_base install_rc install_portable_efi install_xdg
install: install_base install_rc install_runit install_s6 install_xdg
.PHONY: all clean install uninstall dist
.PHONY: install

35
bin/artix-live Normal file
View File

@@ -0,0 +1,35 @@
#!/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}"

View File

@@ -1,50 +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 ${USER_NAME} with password ${PASSWORD}: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
livetimer=$(get_timer_ms)
configure_accountsservice "${USER_NAME}"
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_user_root /
echo "Configured root user: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"

View File

@@ -1,12 +1,16 @@
#!/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 $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 \
@@ -21,8 +25,10 @@ done
if [[ -d /run/openrc ]];then
ln -s $docs/OpenRC.pdf $xdg/OpenRC.pdf
else
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
fluxbox:startfluxbox
pekwm:pekwm
plasma:startkde
gnome:gnome-session
xfce:startxfce4
cinnamon:cinnamon-session-cinnamon
mate:mate-session
enlightenment:enlightenment_start
Lumina-DE:start-lumina-desktop
LXDE:lxsession
lxqt:lxqt-session
pantheon:pantheon-session
budgie-desktop:budgie-desktop
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

@@ -10,11 +10,4 @@ USER_NAME=artix
PASSWORD=artix
# live group membership
ADDGROUPS='video,power,disk,storage,optical,network,lp,scanner,wheel'
# default desktop file
DEFAULT_DESKTOP_FILE=lxqt
# default desktop executable
DEFAULT_DESKTOP_EXECUTABLE=lxqt-session
ADDGROUPS='video,power,cdrom,network,lp,scanner,wheel'

View File

@@ -1,5 +1,5 @@
#!/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
target_dir=/etc/pacman.d/gnupg

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

View File

@@ -0,0 +1 @@
haveged

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

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

@@ -0,0 +1,5 @@
#!/usr/bin/execlineb -P
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
# GNU General Public License for more details.
export LC_MESSAGES=C
export LANG=C
kernel_cmdline(){
for param in $(cat /proc/cmdline); do
case "${param}" in
@@ -33,19 +36,6 @@ get_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(){
[[ -f $1 ]] || return 1
@@ -54,15 +44,13 @@ load_live_config(){
[[ -r ${live_conf} ]] && source ${live_conf}
[[ -z ${AUTOLOGIN} ]] && AUTOLOGIN=true
AUTOLOGIN=${AUTOLOGIN:-true}
[[ -z ${USER_NAME} ]] && USER_NAME="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"
echo "Loaded ${live_conf}: $(elapsed_time_ms ${livetimer})ms" >> "${LOGFILE}"
ADDGROUPS=${ADDGROUPS:-"video,power,cdrom,network,lp,scanner,wheel,users,log"}
return 0
}
@@ -78,19 +66,19 @@ is_valid_de(){
load_desktop_map(){
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")
echo ${desktop_map}
}
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_EXECUTABLE="none"
for item in "${map[@]}";do
key=${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_EXECUTABLE="$val"
fi
@@ -122,16 +110,12 @@ configure_accountsservice(){
done
}
set_lightdm_vt(){
sed -i -e 's/^.*minimum-vt=.*/minimum-vt=7/' /etc/lightdm/lightdm.conf
}
configure_displaymanager(){
# Try to detect desktop environment
# Configure display manager
if [[ -f /usr/bin/lightdm ]];then
groupadd -r autologin
set_lightdm_vt
sed -i -e 's/^.*minimum-vt=.*/minimum-vt=7/' /etc/lightdm/lightdm.conf
set_lightdm_greeter
if $(is_valid_de); then
sed -i -e "s/^.*user-session=.*/user-session=$DEFAULT_DESKTOP_FILE/" /etc/lightdm/lightdm.conf
@@ -168,17 +152,8 @@ gen_pw(){
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 ${USER_NAME}
else
useradd -m -G ${ADDGROUPS} -s /bin/bash ${USER_NAME}
fi
}
find_legacy_keymap(){
local file="${DATADIR}/kbd-model.map" kt="$1"
local file="/usr/share/artools/kbd-model.map" kt="$1"
while read -r line || [[ -n $line ]]; do
if [[ -z $line ]] || [[ $line == \#* ]]; then
continue
@@ -193,7 +168,7 @@ find_legacy_keymap(){
continue
fi
if [[ "${mapping[3]}" = "-" ]]; then
if [[ "${mapping[3]}" == "-" ]]; then
mapping[3]=""
fi
@@ -242,15 +217,9 @@ configure_language(){
local lang=$(get_lang)
local keytable=$(get_keytable)
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
# echo "LANG=${lang}.UTF-8" >> /etc/environment
if [[ -d /run/openrc ]]; then
sed -i "s/keymap=.*/keymap=\"${keytable}\"/" /etc/conf.d/keymaps
fi
@@ -275,8 +244,15 @@ configure_swap(){
fi
}
configure_user_root(){
# set up root password
echo "root:${PASSWORD}" | chroot $1 chpasswd
cp /etc/skel/.{bash_profile,bashrc,bash_logout} /root/
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
}