first attempt for debian10 Slax
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
# Author: Tomas M. <http://www.slax.org/>
|
||||
|
||||
usage()
|
||||
{
|
||||
echo ""
|
||||
echo "Convert directory to .sb compressed module"
|
||||
echo "Usage: $0 [source_directory.sb] [[target_file.sb]]"
|
||||
echo " If source_directory does not have .sb suffix and it is not 'squashfs-root',"
|
||||
echo " then the source_directory itself is included in the module and"
|
||||
echo " then the target_file.sb parameter is required."
|
||||
echo " If target_file.sb is not specified, the source_directory is erased"
|
||||
echo " and replaced by the newly generated module file."
|
||||
}
|
||||
|
||||
P1="$(readlink -f "$1")"
|
||||
P2="$(readlink -f "$2")"
|
||||
|
||||
if [ "$P1" = "$P2" ]; then
|
||||
P2=""
|
||||
fi
|
||||
|
||||
SB=$(echo "$P1" | grep -o "[.]sb/*\$")
|
||||
if [ "$(echo "$P1" | grep -o "/squashfs-root/*\$")" != "" ]; then
|
||||
SB="true"
|
||||
fi
|
||||
|
||||
if [ "$SB" = "" ]; then
|
||||
KEEP="-keep-as-directory"
|
||||
if [ "$P2" = "" ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
KEEP=""
|
||||
fi
|
||||
|
||||
if [ ! -d "$P1" ]; then
|
||||
echo "Not a directory: $P1" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
if [ "$P2" = "" ]; then
|
||||
TARGET="$P1".sb
|
||||
while [ -e "$TARGET" ]; do TARGET="$TARGET"x; done
|
||||
mksquashfs "$P1" "$TARGET" -comp xz -b 1024K -always-use-fragments $KEEP >/dev/null || exit 3
|
||||
umount "$P1" 2>/dev/null
|
||||
rm -Rf "$P1"
|
||||
mv "$TARGET" "$P1"
|
||||
else
|
||||
if [ -e "$P2" ]; then
|
||||
echo "Target exists: $P2" >&2
|
||||
exit 4
|
||||
fi
|
||||
|
||||
mksquashfs "$P1" "$P2" -comp xz -b 1024K -always-use-fragments $KEEP >/dev/null
|
||||
fi
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
CWD=$(pwd)
|
||||
SOURCE=/run/initramfs/memory
|
||||
TEMP=/tmp/slaxiso.$$
|
||||
REGEX='^$'
|
||||
|
||||
if [ "$1" = "-e" ]; then
|
||||
REGEX="$2"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
|
||||
TARGET="$(readlink -f "$1")"
|
||||
|
||||
if [ "$TARGET" = "" ]; then
|
||||
echo ""
|
||||
echo "Generate Slax ISO image, adding specified modules"
|
||||
echo "Regular expression is used to exclude any existing path or file with -e regex"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " $0 [[ -e regex ]] target.iso [[module.sb]] [[module.sb]] ..."
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " # to create Slax iso without chromium.sb module:"
|
||||
echo " $0 -e 'chromium' slax_without_chromium.iso"
|
||||
echo ""
|
||||
echo " # to create Slax text-mode core only:"
|
||||
echo " $0 -e 'firmware|xorg|desktop|apps|chromium' slax_textmode.iso"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e "$SOURCE/data/slax/boot/isolinux.bin" ]; then
|
||||
SLAX=$SOURCE/data/slax
|
||||
fi
|
||||
|
||||
if [ -e "$SOURCE/toram/boot/isolinux.bin" ]; then
|
||||
SLAX=$SOURCE/toram
|
||||
fi
|
||||
|
||||
if [ "$SLAX" = "" ]; then
|
||||
echo "Cannot find boot/isolinux.bin in Slax data" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
GRAFT=\
|
||||
$(
|
||||
cd "$SLAX"
|
||||
find . -type f | sed -r "s:^[.]/::" | egrep -v "^boot/isolinux.(bin|boot)$" | egrep -v "^changes/" | egrep -v "$REGEX" | while read LINE; do
|
||||
echo "slax/$LINE=$SLAX/$LINE"
|
||||
done
|
||||
)
|
||||
|
||||
# add all modules
|
||||
while [ "$2" != "" ]; do
|
||||
if [ ! -e "$2" ]; then
|
||||
echo "File does not exist: $2"
|
||||
exit 3
|
||||
fi
|
||||
BAS="$(basename "$2")"
|
||||
MOD="$(readlink -f "$2")"
|
||||
GRAFT="$GRAFT slax/modules/$BAS=$MOD"
|
||||
shift
|
||||
done
|
||||
|
||||
(
|
||||
mkdir -p $TEMP/slax/{boot,modules,changes}
|
||||
cp "$SLAX/boot/isolinux.bin" "$TEMP/slax/boot"
|
||||
cd "$TEMP"
|
||||
genisoimage -o - -quiet -v -J -R -D -A slax -V slax \
|
||||
-no-emul-boot -boot-info-table -boot-load-size 4 -input-charset utf-8 \
|
||||
-b slax/boot/isolinux.bin -c slax/boot/isolinux.boot \
|
||||
-graft-points $GRAFT \
|
||||
. \
|
||||
) > "$TARGET"
|
||||
|
||||
rm -Rf $TEMP
|
||||
Executable
+86
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
# Rebuild initial ramdisk with full network drivers,
|
||||
# start DHCP and TFTP server in order to provide PXE service
|
||||
#
|
||||
# Author: Tomas M <www.slax.org>
|
||||
|
||||
LIVE=/run/initramfs
|
||||
FTPROOT=/var/state/dnsmasq/root
|
||||
|
||||
# find out our own IP address. If more interfaces are available, use the first one
|
||||
IP="$(hostname -I | cut -d " " -f 1)"
|
||||
GW=$(ip route show | grep default | grep -o "via.*" | head -n 1 | cut -d " " -f 2)
|
||||
|
||||
# if no IP is assigned to this computer, setup private address randomly
|
||||
if [ "$IP" = "" ]; then
|
||||
killall dhclient 2>/dev/null
|
||||
IP="10."$(($RANDOM/130+1))"."$(($RANDOM/130+1))".1"
|
||||
ifconfig $(ls -1 /sys/class/net | egrep -v '^lo$' | sort | head -n 1) $IP netmask 255.255.255.0
|
||||
fi
|
||||
|
||||
# if gateway is not recognized, lets make our IP a gateway and enable forwarding
|
||||
if [ "$GW" = "" ]; then
|
||||
GW="$IP"
|
||||
echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
||||
fi
|
||||
|
||||
echo Starting PXE server on $IP ...
|
||||
|
||||
# calculate C class range
|
||||
RANGE=$(echo $IP | cut -d "." -f 1-3)
|
||||
|
||||
# make sure dnsmasq can be started
|
||||
killall dnsmasq 2>/dev/null
|
||||
killall busybox 2>/dev/null
|
||||
rm -Rf $FTPROOT 2>/dev/null
|
||||
mkdir -p $FTPROOT/{pxelinux.cfg,tmp}/
|
||||
|
||||
# create root filesystem for ftfp
|
||||
cd $LIVE
|
||||
( find . -print | grep -v "memory"
|
||||
cd /
|
||||
find /lib/modules/$(uname -r)/kernel/drivers/net | grep -v wireless
|
||||
) | cpio -pvd $FTPROOT/tmp 2>/dev/null
|
||||
|
||||
cp /lib/modules/$(uname -r)/modules.* $FTPROOT/tmp/lib/modules/$(uname -r)
|
||||
depmod -b $FTPROOT/tmp
|
||||
rm $FTPROOT/tmp/lib/initramfs_escaped
|
||||
|
||||
# pack root in initramfs
|
||||
cd $FTPROOT/tmp
|
||||
find . -print | cpio -o -H newc 2>/dev/null | gzip -f --fast >../initrfs.img
|
||||
cd ..
|
||||
rm -Rf tmp
|
||||
|
||||
# link files here since copying is not necessary
|
||||
ln -s $(find $LIVE/memory/{data,iso,toram} 2>/dev/null | grep vmlinuz | head -n 1) $FTPROOT/vmlinuz
|
||||
ln -s $(find $LIVE/memory/{data,iso,toram} 2>/dev/null | grep pxelinux.0 | head -n 1) $FTPROOT/pxelinux.0
|
||||
ln -s $(find $LIVE/memory/{data,iso,toram} 2>/dev/null | grep ldlinux.c32 | head -n 1) $FTPROOT/ldlinux.c32
|
||||
|
||||
find $LIVE/memory/{data,iso,toram} 2>/dev/null | egrep "[.]sb\$" | sort -n | while read LINE; do
|
||||
BAS="$(basename "$LINE")"
|
||||
ln -s $LINE "$FTPROOT/$BAS"
|
||||
echo $BAS >> "$FTPROOT/PXEFILELIST"
|
||||
done
|
||||
|
||||
echo "This is <a href=http://www.slax.org/>Slax</a> PXE data server. PXE clients will download <a href=PXEFILELIST>file list</a>" > "$FTPROOT/index.html"
|
||||
|
||||
# default pxelinux configuration. Keep xmode selection for clients the same like for the server
|
||||
echo "
|
||||
PROMPT 0
|
||||
DEFAULT slax
|
||||
LABEL slax
|
||||
KERNEL /vmlinuz
|
||||
IPAPPEND 1
|
||||
APPEND initrd=/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 $(cat /proc/cmdline | egrep -o 'slax.flags=[^ ]+' | sed -r 's:[,=]pxe::' | sed -r 's:[,=]toram::')
|
||||
" > $FTPROOT/pxelinux.cfg/default
|
||||
|
||||
# start the DHCP server and TFTP server
|
||||
dnsmasq --enable-tftp --tftp-root=/var/state/dnsmasq/root \
|
||||
--dhcp-boot=pxelinux.0,"$IP",$IP \
|
||||
--dhcp-option=3,$GW \
|
||||
--dhcp-range=$RANGE.2,$RANGE.250,infinite --log-dhcp
|
||||
|
||||
# start HTTP server at port 7529 (that are the numbers you type on your phone to write 'slax')
|
||||
busybox httpd -p 7529 -h /var/state/dnsmasq/root
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# Author: Tomas M. <http://www.slax.org/>
|
||||
|
||||
if [ ! -e "$1" ]; then
|
||||
echo
|
||||
echo "Erase module directory created by sb2dir"
|
||||
echo "Usage: $0 [source_directory.sb]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "Directory does not exist: $1" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
umount "$1" 2>/dev/null
|
||||
rm -Rf "$1"
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
TMP=/tmp/changes$$
|
||||
EXCLUDE="^\$|/\$|[.]wh[.][.]wh[.]orph/|^[.]wh[.][.]wh[.]plnk/|^[.]wh[.][.]wh[.]aufs|^var/cache/|^var/backups/|^var/tmp/|^var/log/|^var/lib/apt/|^var/lib/dhcp/|^var/lib/systemd/|^sbin/fsck[.]aufs|^etc/resolv[.]conf|^root/[.]Xauthority|^root/[.]xsession-errors|^root/[.]fehbg|^root/[.]fluxbox/lastwallpaper|^root/[.]fluxbox/menu_resolution|^etc/mtab|^etc/fstab|^boot/|^dev/|^mnt/|^proc/|^run/|^sys/|^tmp/"
|
||||
CHANGES=/run/initramfs/memory/changes
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo ""
|
||||
echo "savechanges - save all changed files in a compressed filesystem bundle"
|
||||
echo " - excluding some predefined files such as /etc/mtab,"
|
||||
echo " temp & log files, empty directories, apt cache, and such"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " $0 [ target_file.sb ] [ changes_directory ]"
|
||||
echo ""
|
||||
echo "If changes_directory is not specified, /run/initramfs/memory/changes is used."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! "$2" = "" ]; then
|
||||
CHANGES="$2"
|
||||
fi
|
||||
|
||||
# exclude the save_file itself of course
|
||||
EXCLUDE="$EXCLUDE|^""$(readlink -f "$1" | cut -b 2- | sed -r "s/[.]/[.]/")""\$"
|
||||
|
||||
CWD=$(pwd)
|
||||
|
||||
cd $CHANGES || exit
|
||||
|
||||
mkdir -p $TMP
|
||||
mount -t tmpfs tmpfs $TMP
|
||||
|
||||
find \( -type d -printf "%p/\n" , -not -type d -print \) \
|
||||
| sed -r "s/^[.]\\///" | egrep -v "$EXCLUDE" \
|
||||
| while read FILE; do
|
||||
cp --parents -afr "$FILE" "$TMP"
|
||||
done
|
||||
|
||||
cd $CWD
|
||||
|
||||
mksquashfs $TMP "$1" -comp xz -b 1024K -always-use-fragments -noappend
|
||||
|
||||
umount $TMP
|
||||
rmdir $TMP
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Author: Tomas M. <http://www.slax.org/>
|
||||
|
||||
if [ ! -e "$1" ]; then
|
||||
echo
|
||||
echo "Convert .sb compressed module into directory with the same name"
|
||||
echo "Usage: $0 [source_file.sb] [[optional output_directory]]"
|
||||
echo " If the output_directory is specified, it must exist"
|
||||
echo " If the output_directory is not specified, the name source_file.sb"
|
||||
echo " is used and the directory is overmounted with tmpfs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -r "$1" ]; then
|
||||
echo "File does not exist: $1" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$2" = "" ]; then
|
||||
SOURCE="$1".x
|
||||
while [ -e "$SOURCE" ]; do SOURCE="$SOURCE"x; done
|
||||
mv "$1" "$SOURCE" || exit
|
||||
mkdir "$1"
|
||||
mount -t tmpfs tmpfs "$1"
|
||||
unsquashfs -f -dest "$1" "$SOURCE" >/dev/null || exit
|
||||
rm "$SOURCE"
|
||||
else
|
||||
if [ ! -d "$2" ]; then
|
||||
echo "Directory does not exist: $2" >&2
|
||||
exit
|
||||
fi
|
||||
unsquashfs -f -dest "$2" "$1" >/dev/null
|
||||
fi
|
||||
Executable
+167
@@ -0,0 +1,167 @@
|
||||
#!/bin/bash
|
||||
# Slax management and control script
|
||||
# Author: Tomas M <http://www.slax.org/>
|
||||
|
||||
# activate
|
||||
# deactivate
|
||||
# list
|
||||
|
||||
|
||||
LIVE=/run/initramfs/memory
|
||||
RAMSTORE=$LIVE/modules
|
||||
|
||||
# Print error message and exit
|
||||
# $1 = error message
|
||||
#
|
||||
die()
|
||||
{
|
||||
echo "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
print_branches()
|
||||
{
|
||||
local SI BUNDLE LOOP CWD
|
||||
|
||||
SI="/sys/fs/aufs/$(cat /proc/mounts | grep 'aufs / aufs' | egrep -o 'si=([^,) ]+)' | tr = _)"
|
||||
CWD="$(pwd)"
|
||||
cd "$SI"
|
||||
ls -v1 | grep -v xi_path | egrep 'br[0-9]+' | xargs cat | grep memory/bundles | rev | cut -b 4- | rev | while read BUNDLE; do
|
||||
if mountpoint -q "$BUNDLE"; then
|
||||
LOOP=$(cat /proc/mounts | fgrep " $BUNDLE squashfs" | cut -d " " -f 1)
|
||||
echo -n "$BUNDLE"
|
||||
echo -ne "\t"
|
||||
losetup $LOOP | sed -r "s:.*[(]|[)].*::g"
|
||||
fi
|
||||
done | tac
|
||||
cd "$CWD"
|
||||
}
|
||||
|
||||
|
||||
# Activate Slax Bundle
|
||||
# $1 = file to activate
|
||||
#
|
||||
activate()
|
||||
{
|
||||
local SB TGT BAS
|
||||
|
||||
SB="$(readlink -f "$1")"
|
||||
BAS="$(basename "$SB")"
|
||||
|
||||
# check if file exists
|
||||
if [ ! -r "$SB" ]; then
|
||||
usage "file not found $SB"
|
||||
fi
|
||||
|
||||
# check if the file is part of aufs union, if yes we need to copy it outside
|
||||
if df "$SB" | cut -d " " -f 1 | grep -q aufs; then
|
||||
TGT="$RAMSTORE"
|
||||
mkdir -p "$TGT"
|
||||
if [ -r $TGT/$BAS ]; then die "File exists: $TGT/$BAS"; fi
|
||||
cp -n "$SB" "$TGT/$BAS"
|
||||
if [ $? -ne 0 ]; then die "Error copying file to $TGT/$BAS. Not enough free RAM or disk space?"; fi
|
||||
SB="$TGT/$BAS"
|
||||
fi
|
||||
|
||||
# check if this particular file is already activated
|
||||
if print_branches | cut -f 2 | fgrep -q "$SB"; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# mount remount,add
|
||||
TGT="$LIVE/bundles/$BAS"
|
||||
mkdir -p "$TGT"
|
||||
|
||||
mount -n -o loop,ro "$SB" "$TGT"
|
||||
if [ $? -ne 0 ]; then
|
||||
die "Error mounting $SB to $TGT, perhaps corrupted download"
|
||||
fi
|
||||
|
||||
# add current branch to aufs union
|
||||
mount -t aufs -o remount,add:1:"$TGT" aufs /
|
||||
if [ $? -ne 0 ]; then
|
||||
umount "$TGT"
|
||||
rmdir "$TGT"
|
||||
die "Error attaching bundle filesystem to Slax"
|
||||
fi
|
||||
|
||||
echo "Slax Bundle activated: $BAS"
|
||||
}
|
||||
|
||||
|
||||
# Deactivate Slax bundle of the given name
|
||||
# $1 = path to bundle file, or its name
|
||||
#
|
||||
deactivate()
|
||||
{
|
||||
local BUNDLES SB MATCH LOOP LOOPFILE
|
||||
|
||||
BUNDLES=$LIVE/bundles
|
||||
MODULES=$LIVE/modules
|
||||
SB="$(basename "$1")"
|
||||
|
||||
rmdir "$BUNDLES/$SB" 2>/dev/null # this fails unless the dir is
|
||||
rmdir "$BUNDLES/$SB.sb" 2>/dev/null # forgotten there empty. It's safe this way
|
||||
|
||||
if [ ! -d "$BUNDLES/$SB" ]; then
|
||||
# we don't have real filename match, lets try to add .sb extension
|
||||
if [ ! -d "$BUNDLES/$SB.sb" ]; then
|
||||
# no, still no match. Lets use some guesswork
|
||||
SB=$(print_branches | cut -f 2 | egrep -o "/[0-9]+-$SB.sb\$" | tail -n 1 | xargs -r basename)
|
||||
else
|
||||
SB="$SB.sb"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SB" = "" -o ! -d "$BUNDLES/$SB" ]; then
|
||||
die "can't find active slax bundle $1"
|
||||
fi
|
||||
|
||||
echo "Attempting to deactivate Slax bundle $SB..."
|
||||
mount -t aufs -o remount,verbose,del:"$BUNDLES/$SB" aufs / 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
die "Unable to deactivate Slax Bundle - still in use. See dmesg for more."
|
||||
fi
|
||||
|
||||
# remember what loop device was the bundle mounted to, it may be needed later
|
||||
LOOP="$(cat /proc/mounts | fgrep " $BUNDLES/$SB " | cut -d " " -f 1)"
|
||||
LOOPFILE="$(losetup "$LOOP" | cut -d " " -f 3 | sed -r 's:^.|.$::g')"
|
||||
|
||||
umount "$BUNDLES/$SB" 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
die "Unable to umount Slax bundle loop-mount $BUNDLES/$SB"
|
||||
fi
|
||||
rmdir "$BUNDLES/$SB"
|
||||
|
||||
# free the loop device manually since umount fails to do that if the bundle was activated on boot
|
||||
losetup -d "$LOOP" 2>/dev/null
|
||||
|
||||
if echo "$LOOPFILE" | grep -q $RAMSTORE; then
|
||||
rm -f $LOOPFILE
|
||||
fi
|
||||
|
||||
echo "Slax Bundle deactivated: $SB"
|
||||
}
|
||||
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
die "Usage: $0 [ activate | deactivate | list ] [ file.sb ]"
|
||||
fi
|
||||
|
||||
if [ "$1" = "activate" ]; then
|
||||
activate "$2"
|
||||
fi
|
||||
|
||||
if [ "$1" = "deactivate" ]; then
|
||||
deactivate "$2"
|
||||
fi
|
||||
|
||||
if [ "$1" = "list" ]; then
|
||||
print_branches
|
||||
fi
|
||||
|
||||
if [ "$1" = "savechanges" ]; then
|
||||
shift
|
||||
savechanges "$@"
|
||||
fi
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=DHCP Client
|
||||
Documentation=man:dhclient(8)
|
||||
Wants=network.target
|
||||
After=network-pre.target systemd-sysctl.service systemd-modules-load.service
|
||||
Before=network.target shutdown.target network-online.target
|
||||
ConditionPathExists=!/run/initramfs/net.up.flag
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=-/bin/sh -c 'udevadm settle && dhclient -nw'
|
||||
PIDFile=/run/dhclient.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=network-online.target
|
||||
@@ -0,0 +1,54 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Getty on %I
|
||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||
Documentation=http://0pointer.de/blog/projects/serial-console.html
|
||||
After=systemd-user-sessions.service plymouth-quit-wait.service
|
||||
After=rc-local.service
|
||||
|
||||
# If additional gettys are spawned during boot then we should make
|
||||
# sure that this is synchronized before getty.target, even though
|
||||
# getty.target didn't actually pull it in.
|
||||
Before=getty.target
|
||||
IgnoreOnIsolate=yes
|
||||
|
||||
# IgnoreOnIsolate causes issues with sulogin, if someone isolates
|
||||
# rescue.target or starts rescue.service from multi-user.target or
|
||||
# graphical.target.
|
||||
Conflicts=rescue.service
|
||||
Before=rescue.service
|
||||
|
||||
# On systems without virtual consoles, don't start any getty. Note
|
||||
# that serial gettys are covered by serial-getty@.service, not this
|
||||
# unit.
|
||||
ConditionPathExists=/dev/tty0
|
||||
|
||||
[Service]
|
||||
# the VT is cleared by TTYVTDisallocate
|
||||
ExecStart=-/sbin/agetty --noclear %I $TERM
|
||||
Type=idle
|
||||
Restart=always
|
||||
RestartSec=0
|
||||
UtmpIdentifier=%I
|
||||
TTYPath=/dev/%I
|
||||
TTYReset=yes
|
||||
TTYVHangup=yes
|
||||
#TM do not clear VT:
|
||||
TTYVTDisallocate=no
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
SendSIGHUP=yes
|
||||
|
||||
# Unset locale for the console getty since the console has problems
|
||||
# displaying some internationalized messages.
|
||||
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
|
||||
|
||||
[Install]
|
||||
WantedBy=getty.target
|
||||
DefaultInstance=tty1
|
||||
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=OpenBSD Secure Shell server
|
||||
After=network.target auditd.service
|
||||
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/default/ssh
|
||||
ExecStartPre=-/bin/sh -c 'if ! ls /etc/ssh/ssh_host_* >/dev/null 2>&1; then /usr/sbin/dpkg-reconfigure openssh-server; fi'
|
||||
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=process
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=255
|
||||
Type=notify
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=sshd.service
|
||||
@@ -0,0 +1,2 @@
|
||||
# we don't care about loop* and ram* devices
|
||||
KERNEL=="[!lr]*", SUBSYSTEM=="block", RUN+="/sbin/slax-automount %r/%k"
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOCK=/run/lock/gtk-bookmark-update-lock
|
||||
BOOKMARKS=/root/.gtk-bookmarks
|
||||
|
||||
# make sure to avoid parallel execution by using mkdir as lock
|
||||
while true; do
|
||||
mkdir $LOCK 2>/dev/null
|
||||
if [ $? = 0 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
cat $BOOKMARKS | fgrep -v ///media/ | fgrep -v "file:/// /" | egrep -v '^$' > $BOOKMARKS.tmp 2>/dev/null
|
||||
ls -1 /media | sort | while read LINE; do
|
||||
echo "file:///media/$LINE $LINE" >> $BOOKMARKS.tmp
|
||||
done
|
||||
|
||||
echo "file:/// /" >> $BOOKMARKS.tmp # add root at the beginning
|
||||
|
||||
mv -f $BOOKMARKS.tmp $BOOKMARKS
|
||||
|
||||
rmdir $LOCK
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
# Recreate fstab entries in /etc/fstab and make /media directories
|
||||
# This script is called by udev rules, see /lib/udev/rules.d/
|
||||
#
|
||||
# Author: Tomas M <http://slax.linux-live.org/>
|
||||
|
||||
# Variables available in udev environment:
|
||||
# $ACTION (eg: add, remove)
|
||||
# $DEVNAME (full device node name including path)
|
||||
# $DEVTYPE (eg: disk)
|
||||
# $ID_FS_TYPE (eg: ext3)
|
||||
# $MAJOR and $MINOR numbers
|
||||
# $SUBSYSTEM (eg: block)
|
||||
|
||||
PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin
|
||||
|
||||
BAS="$(basename "$DEVNAME")"
|
||||
UNIT="media-$BAS.mount"
|
||||
MNT="/media/$BAS"
|
||||
TARGET="/etc/systemd/system/$UNIT"
|
||||
|
||||
|
||||
# exit if noautomount boot parameter is present
|
||||
if cat /proc/cmdline | grep -q noautomount; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# exit if 'automount' boot parameter is missing
|
||||
if ! cat /proc/cmdline | grep -q automount; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
if [ "$ACTION" = "add" -o "$ACTION" = "change" ]; then
|
||||
if [ ! -r "$TARGET" ]; then # skip if exists
|
||||
|
||||
if [ "$ID_FS_TYPE" != "" -a "$(cat /proc/filesystems | grep "$ID_FS_TYPE")" != "" ]; then
|
||||
|
||||
mkdir -p "$MNT"
|
||||
|
||||
echo "[Unit]" >$TARGET
|
||||
echo "Description=Disk $BAS" >>$TARGET
|
||||
echo "" >>$TARGET
|
||||
echo "[Mount]" >>$TARGET
|
||||
echo "What=$DEVNAME" >>$TARGET
|
||||
echo "Where=$MNT" >>$TARGET
|
||||
echo "Type=$ID_FS_TYPE" >>$TARGET
|
||||
echo "Options=defaults" >>$TARGET
|
||||
echo "" >>$TARGET
|
||||
echo "[Install]" >>$TARGET
|
||||
echo "WantedBy=multi-user.target" >>$TARGET
|
||||
|
||||
systemctl enable $UNIT
|
||||
systemctl start $UNIT
|
||||
|
||||
gtk-bookmarks-update
|
||||
DISPLAY=:0.0 pcmanfm -n file://$MNT >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ACTION" = "remove" ]; then
|
||||
systemctl disable $UNIT
|
||||
rm "$TARGET"
|
||||
rmdir "$MNT"
|
||||
gtk-bookmarks-update
|
||||
fi
|
||||
Reference in New Issue
Block a user