Commit 813292e0 authored by Ali Riza KESKIN's avatar Ali Riza KESKIN
Browse files

output improvement and no-color.org support

parent f852be49
#!/bin/bash
set -e
source /usr/lib/sulin/dsl/functions.sh
if [[ "$1" == "--help" ]] ; then
echo "debian [options]"
echo " --help : Write this message"
......@@ -37,14 +38,18 @@ elif [[ "$1" == "-c" ]] ; then
fi
elif [[ "$1" == "--update" ]] ; then
if [[ "$UID" != 0 ]] ; then
echo "You must be root!"
msg "Error" "You must be root!"
exit 1
fi
source /usr/lib/sulin/dsl/functions.sh
if ! check_update ; then
echo "No update found. Already up to date."
exit 0
fi
rm -f ${DESTDIR}/var/cache/app-ltime
msg "Info" "Unmount all"
umount_all
msg "Info" "Sync group id"
sync_gid
msg "Info" "Sync applications"
sync_desktop
msg "Info" "Check update"
check_update
else
$(get_root) /usr/lib/sulin/dsl/dsl.sh
fi
......
......@@ -20,7 +20,7 @@ if [[ "$1" == "--kill" ]] ; then
set +e
PID_LIST=$(ps aux | grep -v grep | grep dsl.sh | tr -s ' ' | cut -f 2 -d ' ')
for p in ${PID_LIST[@]} ; do
echo "kill $p"
msg "Kill" "$p"
kill -9 $p || true
done
pactl unload-module module-native-protocol-tcp &>/dev/null
......
......@@ -6,7 +6,7 @@ source /usr/lib/sulin/dsl/variable.sh
source /usr/lib/sulin/dsl/functions.sh
echo -n "$SYSTEM" > /proc/$$/comm
wsl_block || {
echo "Fucking WSL environment is not allowed!"
msg "FUCK" "Fucking WSL environment is not allowed!"
echo -e "\033[?25l"
trap '' 2
while true ; do
......@@ -14,13 +14,13 @@ wsl_block || {
done
}
debian_check || {
echo "Debian installation failed."
echo "Press any key to exit"
msg "Error" "Debian installation failed."
msg "Info" "Press any key to exit"
read -s -n 1 && exit 1
}
if ! ls ${DESTDIR}/run/hostctl&>/dev/null ; then
echo "Starting hostctl"
msg "Starting" "hostctl"
mkfifo ${DESTDIR}/run/hostctl&>/dev/null || true
chmod 700 ${DESTDIR}/run/hostctl&>/dev/null || true
chown ${USERNAME} ${DESTDIR}/run/hostctl
......
set -e
msg(){
echo -e "\033[32;1m$1\033[;0m $2"
}
if [[ "$NO_COLOR" == "" ]] ; then
msg(){
col="32"
[[ "$1" == "Error" ]] && col=31
echo -e "\033[$col;1m$1\033[;0m $2"
}
else
msg(){
echo "$1 $2"
}
fi
wsl_block(){
var=$(uname -r)
[[ ! -f /proc/cpuinfo ]] && return 1
......@@ -57,7 +65,7 @@ debian_init(){
[[ $(uname -m) == "x86_64" ]] && arch=amd64
[[ $(uname -m) == "aarch64" ]] && arch=arm64
[[ $(uname -m) == "i686" ]] && arch=i386
[[ "$arch" == "" ]] && echo "Unsupported arch $(uname -m)" && exit 1
[[ "$arch" == "" ]] && msg "Error" "Unsupported arch $(uname -m)" && exit 1
if [[ "$DIST" == "ubuntu-latest" ]] ; then
DIST=$(curl https://cdimage.ubuntu.com/daily-live/current/ | grep "desktop-amd64.iso" | head -n 1 | sed "s/.*href=\"//g;s/-.*//g")
fi
......@@ -337,7 +345,7 @@ run(){
if [[ ! -n $nopidone && ${use_pidone} != "false" ]] ; then
exec pidone $(get_chroot) ${DESTDIR} debrun "$@"
else
echo "Running without PID isolation"
msg "Info" "Running without PID isolation"
exec $(get_chroot) ${DESTDIR} debrun "$@"
fi
}
......@@ -352,7 +360,7 @@ get_chroot(){
}
fail_exit(){
echo -e "\033[31;1mError: \033[;0m$*"
msg "Error" "$*"
echo -n " => Press any key to exit"
read -s -n 1 && exit 1
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment