In alpine linux i wanna do a more minimal install of xfce via setup-desktop that does not use x11 xorg but uses wayland instead, also i dont wanna install firefox, study below how can i use setup-wayland-base instead with that script i gave you
Set up system to use Wayland
options:
-h Show this help
Installs and enables elogind, enables community repository, enable udev
and install the packages PKG if specified.
__EOF__
exit $1
}
while getopts "h" opt; do
case opt in
h) usage 0;;
'?') usage "1" >&2;;
esac
done
shift (($OPTIND - 1))
For every main/ repo, enable corresponding community/ repo
setup-apkrepos -o
apk add elogind polkit-elogind eudev "$@"
setup-devd udev
for service in elogind polkit; do
rc-service "service"startrc−service"
done
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Set up system to use Xorg
options:
-h Show this help
Installs xorg-server, enables community repository, enable udev and
install the packages PKG if specified.
__EOF__
exit $1
}
while getopts "h" opt; do
case opt in
h) usage 0;;
'?') usage "1" >&2;;
esac
done
shift (($OPTIND - 1))
For every main/ repo, enable corresponding community/ repo
sorted_ifaces() {
for i in "ROOT"/sys/class/net/∗;dolocaliface="{i##*/}"
if [ -e "i"/ifindex];thenprintf"(cat i/ifindex)""iface"
fi
done | sort -n | awk '{print $2}'
}
list of available network interfaces that aren't part of any bridge or bond
available_ifaces() {
local iflist= ifpath= iface=
if ! [ -d "ROOT"/sys/class/net];theniplink∣awk−F:′1 ~ /^[0-9]+/ {printf "%s",2}'
return
fi
for iface in (sorted_ifaces); do
# skip interfaces that are part of a bond or bridge
ifpath="ROOT/sys/class/net/iface"if[−d"ifpath"/master/bonding ] || [ -d "ifpath"/brport]∣∣["iface" = "lo" ]; then
continue
fi
iflist="iflist{iflist:+ }iface"doneechoiflist
}
Ask for a password twice, saving the input in $_password
askpassword() {
local _oifs="IFS"IFS=while:;doaskpass"Passwordfor1 account? (will not echo)"
_password=$resp
askpass "Password for $1 account? (again)"
# N.B.: Need quotes around $resp and $_password to preserve leading
# or trailing spaces.
[ "$resp" = "$_password" ] && break
echo "Passwords do not match, try again."
done
IFS=$_oifs
}
test the first argument against the remaining ones, return success on a match
N.B.! 3and4 will be "expanded" using eval, so be sure to escape them
if they contain spooky stuff
At exit $resp holds selected item, or 'done'
ask_which() {
local _name="1"query="2" _list="3"def="4" _dynlist _dyndef
while :; do
# Put both lines in ask prompt, rather than use a
# separate 'echo' to ensure the entire question is
# re-ask'ed after a '!' or '!foo' shell escape.
eval "_dynlist=\"$_list\""
eval "_dyndef=\"$_def\""
# Clean away whitespace and determine the default
set -o noglob
set -- $_dyndef; _dyndef="$1"
set -- $_dynlist; _dynlist="$*"
set +o noglob
[ $# -lt 1 ] && resp=done && return
: ${_dyndef:=$1}
echo "Available ${_name}s are: $_dynlist."
printf "Which one %s? (or 'done') " "$_query"
[ -n "$_dyndef" ] && printf "[%s] " "$_dyndef"
_ask || continue
[ -z "$resp" ] && resp="$_dyndef"
# Quote $resp to prevent user from confusing isin() by
# entering something like 'a a'.
isin "$resp" $_dynlist done && break
echo "'$resp' is not a valid choice."
done
}
find_modloop_media() {
devnum=(mountpoint−d/.modloop)∣∣returntest−n"devnum" || return
modloop_file=(cat/sys/dev/block/devnum/loop/backing_file) || return
test -n "modloop_file" || return
# assume that device name and mount point don't contain spaces
modloop_media=(df "modloop_file" | awk 'NR==2{print 6}') || return
test -n "modloopmedia"∣∣returnecho"modloop_media"
}
Extract fully qualified domain name from current hostname. If none is
Install a standard desktop
options:
-h Show this help
__EOF__
exit $1
}
while getopts "h" opt; do
case opt in
h) usage 0;;
'?') usage "1" >&2;;
esac
done
shift (($OPTIND - 1))
if [ $# -gt 1 ]; then
usage "1" >&2
fi
if [ # -eq 0 ]; then
users=(awk -F: '{if (3<65000 && 3 >= 1000) print 1}' "ROOT"/etc/passwd 2>/dev/null)
if [ -z "$users" ]; then
setup-user -g "audio,video,netdev"
fi
fi
de="$1"
valid_desktops="xfce gnome plasma mate sway none"
if [ # -eq 1 ] && ! isin "de" validdesktops;thenecho"de is not a valid desktop" >&2
usage "1" >&2
fi
shift
while ! isin "de"valid_desktops; do
ask "Which desktop environment? ('gnome', 'plasma', 'xfce', 'mate', 'sway' or 'none')" none
de="$resp"
done
case "de"innone)exit0;;mate)setup−xorg−basemate−desktop−environment{BROWSER:-firefox}
consolekit2
gvfs
lightdm
lightdm-gtk-greeter
polkit
dbus
dbus-x11
font-dejavu
"@"rc−updateadddbusrc−{BROWSER:-firefox}
consolekit2
gvfs
lightdm
lightdm-gtk-greeter
polkit
xfce4-terminal
"@"rc−updateaddlightdm;;gnome)setu{BROWSER:-firefox} "@"
# apk info needs community repos which are enabled with setup-xorg-base
apk add (apk info --quiet --depends gnome gnome-apps-core)
rc-update add gdm
rc-update add elogind
;;
plasma)
setup-xorg-base @"
rc-update add dbus
rc-update add sddm
;;
sway)
setup-wayland-base @"
;;
*)
usage "1" >&2
;;
esac
users=(awk -F: '{if (3<65000 && 3>=1000)print1}' "ROOT"/etc/passwd2>/dev/null)if[−z"users" ]; then
echo "WARNING: You need to create a user account. Please run: setup-user" >&2
echo "" >&2
fi
ok here's the startxfce4 script which i need to modify because it's crashing again and trying to start xinit instead ( which we obviously dont have)
if test
"×∗"?="x"thenOPTS=∗∗∗•forOPTinS∗doiftest"xOPT" = "x--help"
then
print help
echo
ntsage?,, and exit
echo "
startxfce4 [OPTIONS...]"
echo echo echo echo
"Options:"
--help
—-with-ck-launch
echo echo
Show help options"
Start xfce4-session inside a"
ConsoleKit session"
exit 0
elif test
"x$OPT" = "x--with-ck-launch"
then
try to launch xfce4-session with ck-launch-session in xinitrc
OPTS="OPTSSOPT"fidoneiftestthenCLIENTRC=(OPTS}
else
SERVERRC=(OPTS#*- }
CLIENTRC=(OPTS%--*}
"xCOPTS#*-]" = "x(OPTS]"
fi fi
if test then
else
"XXDGCONFIGHOME"HOME/ .config/xfce4/"
BASED IR="XDGCONFIGHOME/xXDG_DATA DIRS" = "x"
then
"EDAT.DS=S/1cal/Shate:/st/Share""susr/share"="x/ust/share" then
else
XDG_DATA_DIRS="/usr/Share:/usr/local/share:/usr/share"
fi
If SXDG_DATA_DIRS is pre-defined, but does not end with /usr/share, append it elif test
"EXDG_DATA_DIRS##*:}" !=
"/usr/share"
then
XDG _DATA_DIRS="SDG_DATA_DIRS:/usr/share"
fi export XDG_DATA_DIRS
if test "xXDG_CONFIG_DIRS" = "x"
then
if test "x/etc" = "x/etc"; then
XDG_CONFIG_DIRS="/etc/xdg"
else
XDG_CONFIG_DIRS="/etc/xdg :/etc/xdg"
fi
If XDG_CONFIG_DIRS is pre-defined, but does not end with /etc/xdg, append it elif test
"SEXDG CONFIG DIRS##*:3"
!= "/etc/xdg"
then
XDG_CONFIG_DIRS="DG_CONFIG_DIRS: /etc/xdg"
fi export XDG_CONFIG_DIRS
if test "xDISPLAY" = "x"
then
echo "0:StartingXserver"prog−xinitiftestXDG_VTNR" = "x"; then
SERVERRC="SERVERRCvtXDG_UTN"
fi else echo
"o:XserveralreadyrumingondisplayDISPLAY"
prog=/bin/sh
fi
if [ -f "SHOME/.xserverrc" 1: then
SERVERRC="SHOME/ xserverre SERVERRC"elifSERVERRC"
fi
if test ? "xSERVERRC"="x"thenSERVERRC="−−SERVERRC"
fi
if [ -f BASEDIR/xinitrc];thenexecprog BASEDIR/xinitrcCLIENTRC SERUERRCelif[−fHOME/.xfce4/xinitrc ]; then
mkdir -p BASEDIRcpSHOME/.xfce4/xinitrcBASEDIR/ exec Sprog BASEDIR/xinitrcCLIENTRC SERVERRCelseexecSprog/etc/xdgSERVERRC
fi
Keep in mind for my last piece of code for startxfce my OCR may be inaccurate as often $HOME is written as SHOME etc
but again I wanna modify stuff it so i can use wayland with xfce instead
To achieve a minimal installation of XFCE on Alpine Linux using Wayland instead of X11, and to exclude Firefox from the installation, you'll need to make several modifications to your existing scripts. Here's a comprehensive guide to help you accomplish this:
1. Modify the setup-desktop Script
The setup-desktop script is responsible for installing the desktop environment and its dependencies. By default, for XFCE, it uses setup-xorg-base, which installs X11/Xorg packages. To switch to Wayland and exclude Firefox, follow these steps:
a. Create a Custom Setup Script
Instead of modifying the original setup-desktop, it's safer to create a custom version to prevent overwriting original scripts. Let's name it setup-desktop-wayland.
Switched to setup-wayland-base: This ensures that Wayland-related dependencies are installed instead of Xorg.
Removed Firefox: By eliminating ${BROWSER:-firefox}, Firefox won't be installed.
Added xwayland: XFCE doesn’t have native Wayland support, so xwayland is necessary to run X11 applications within a Wayland session.
d. Save and Exit
After making the changes, save the file and exit the editor (Ctrl + X, then Y, and Enter for nano).
2. Ensure Necessary Wayland Packages Are Installed
While setup-wayland-base installs essential Wayland components, ensure that additional packages required for XFCE and Wayland integration are present.
apk add xwayland
3. Modify the startxfce4 Script
The startxfce4 script is designed to start an XFCE session, typically leveraging X11. Since we aim to use Wayland, we'll simplify this script to launch the XFCE session directly without invoking xinit.
a. Create a Custom startxfce4 Script
It's advisable to create a custom version to avoid disrupting the original. Let's name it startxfce4-wayland.
Wayland Support Limitations: XFCE's native Wayland support is limited. Some components might still rely on X11. Ensure that xwayland is installed to handle these dependencies.
Alternative Compositors: If you encounter persistent issues, consider using a compositor with better Wayland support or a different desktop environment that natively supports Wayland, such as Sway.
9. Final Thoughts
Switching XFCE to use Wayland on Alpine Linux is a commendable goal for a minimal and modern desktop setup. However, be aware that XFCE's Wayland support isn't as mature as some other desktop environments. You might encounter limitations or require additional tweaks to get everything working smoothly. Always ensure you have backups or recovery options in case you need to revert changes.
Summary of Changes:
Custom setup-desktop-wayland Script:
Switched from setup-xorg-base to setup-wayland-base.
Removed Firefox from the package list.
Added xwayland to support X11 applications.
Custom startxfce4-wayland Script:
Simplified to start xfce4-session directly under Wayland using dbus-run-session.
LightDM Configuration:
Enabled Wayland usage in LightDM.
Package Installation:
Ensured all necessary Wayland-related packages are installed.
By following these steps, you should have a more minimal XFCE installation running on Wayland without Firefox on Alpine Linux.