Page 1 of 1

Fun with PS1

Posted: Thu Apr 21, 2022 7:41 am
by user1111

Select All the following, paste it into geany, save as ~/p, and in a terminal source it (run . ~/p)

Code: Select all

# source this # i.e. if a file called p in your home folder ...
# . ~/p

export PS1="\033[33m
                                                      
 ███████╗╔█████╗ ████████╗██████╗ ╔██████╗ ╔██████╗   
 ██╔════╝██╔══██╗╚══██╔══╝██╔══██╗██╔═══██╗██╔════╝   
 █████╗  ███████║   ██║   ██║  ██║██║   ██║██║  ███╗  
 ██╔══╝  ██╔══██║   ██║   ██║  ██║██║   ██║██║   ██║  
 ██║     ██║  ██║   ██║   ██████╔╝╚██████╔╝╚██████╔╝  
 ╚═╝     ╚═╝  ╚═╝   ╚═╝   ╚═════╝  ╚═════╝  ╚═════╝   
\033[32m\d
\033[36m\A\033[m # "

Your terminal prompt should then look like ...

i.png
i.png (14.41 KiB) Viewed 1080 times

Re: Fun with PS1

Posted: Thu Apr 21, 2022 9:24 am
by user1234

Really good :thumbup: :thumbup:.


Re: Fun with PS1

Posted: Thu Apr 21, 2022 11:53 am
by Grey

I started making a logo for terminal last year when I used Fatdog for a while. I never got used to the system, and the dog remained unpainted until the end :)
By the way, the authors, make your dog go on a diet and let him (or is it she?!) do sports. No, really, it is so voluminous that it is difficult to draw it :)

fatdog_ansi_0.png
fatdog_ansi_0.png (22.81 KiB) Viewed 1059 times

Re: Fun with PS1

Posted: Fri Apr 22, 2022 2:55 pm
by jamesbond

LOL :lol: have fun guys. :mrgreen:


Re: Fun with PS1

Posted: Sat Apr 23, 2022 10:46 am
by user1111
jamesbond wrote: Fri Apr 22, 2022 2:55 pm

LOL :lol: have fun guys. :mrgreen:

Much fun to be had thanks to you James and the rest of the Fatdog team.

As a build system Fatdog is great. Recently built a kernel + busybox alone system - where busybox includes telnet so you can access BBS's

Image

For connection I'm using a android phone USB/tethered. Around a 6MB OS (kernel + userland (busybox)). Referencing the Fatdog build recipe adding dropbear for ssh functionality, again like busybox statically build (no libs), extends the operability to include the likes of ssh into hashbang for email, irc, browsing.

Works well, excepting I haven't got DNS working yet. Net connected and I can access everything via IP, including DNS servers (nslookup somesitename someDNSserverIP to get the sites IP) have a DNS IP as the first line in resolv.conf, but just doesn't support name resolution (telnet somesite fails). Not a great hardship, if anything perhaps better as it forces you do directly access a DNS IP so you can be selective at the time as to which one to use.

Build kernel

Code: Select all

wget http://kernel.org/pub/linux/kernel/v5.x/linux-5.4.71.tar.xz
mkdir bootfiles
tar -xvf linux-5.4.71.tar.xz
cd linux-5.4.71
cp ../.config .

N=`nproc`
N=`expr $N + 1`

yes "" | make oldconfig
#make localyesconfig
yes "" | make -j$N
cp arch/x86/boot/bzImage ../bootfiles/vmlinuz
echo vmlinuz should now be ready in bootfiles folder

Build busybox

Code: Select all

# ENSURE DEVX SFS IS LOADED
# ENSURE THE .config FILE IS IN THE SAME FOLDER AS BUILD.SH
# RUN THIS SCRIPT FROM THE FOLDER WHERE BUILD.SH IS LOCATED
# Builds a static version of busybox

wget http://busybox.net/downloads/busybox-1.31.1.tar.bz2
tar -xvf busybox-1.31.1.tar.bz2
cd busybox-1.31.1
make distclean defconfig
sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config
make busybox install
cd _install
rm -f linuxrc

Build dropbear notes

Code: Select all

#load fatdog devx sfs

# install musl-lib from gslapt

# Download a version from : https://matt.ucc.asn.au/dropbear/releases

export CC="musl-gcc"
export PKG_CONFIG_PATH=/tmp/static/lib/pkgconfig/
	
./configure $CONFFLAGS --enable-static --disable-zlib --enable-bundled-libtom 
	
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp scp-progress" MULTI=1

With lots of time messing around with kernel make menuconfig and rebuilds.

/init inside ramfs

Code: Select all

#!/bin/ash

[ $$ -eq 1 ] || exit 1				  # bail out unless we're PID 1

/bin/mount -t proc proc /proc				    # mount /proc first
mount -t sysfs sysfs /sys
if ! mount -t devtmpfs devtmpfs /dev 2> /null; then # /dev/null might not exist
			       # if no devtmpfs, use tmpfs and use mdev instead
	mount -t tmpfs tmpfs /dev -o mode=755  # mode 755 is what devtmpfs uses
	mdev -s
fi
[ -f /null ] && rm /null		 # Clear up the null file created above
[ ! -e /dev/shm ] && mkdir -p /dev/shm
[ ! -e /dev/pts ] && mkdir -p /dev/pts

exec /sbin/init	       # hand over to busybox init (that initiates /etc/inittab
                            # its own internal one when no /etc/inittab exists,
                                                 # that invokes /etc/init.d/rcS

Want to see (yet to test) if that last line could be a direct busybox call
exec busybox init

/etc/init.d/rcS .. just loads keys and font

Code: Select all

#!/bin/sh
  #  Our rootfs/initrd invokes busybox /sbin/init that runs /etc/inittab is one
  # exists or uses its own internal version if it doesn't exist. We leave it to
  #  use its internal version .. and that invokes /etc/init.d/rcS ... this file

cat "/usr/share/keymaps/uk" | loadkmap			       # load uk keymap
echo uk >/etc/keymap
					       # ter-i32b works well with BBS's
zcat /usr/share/consolefonts/ter-i32b.psf.gz | loadfont	     # set console font
echo 850 > /etc/codepage

Thanks for all the tears and cheers :thumbup2:


Re: Fun with PS1

Posted: Sat Apr 23, 2022 11:06 am
by user1111

Yep,
exec /bin/busybox init
as the last line in /init works fine. If there's no /etc/inittab present then busybox uses its own hard coded version that looks like ...

# ::sysinit:/etc/init.d/rcS
# ::askfirst:/bin/sh
# ::ctrlaltdel:/sbin/reboot
# ::shutdown:/sbin/swapoff -a
# ::shutdown:/bin/umount -a -r
# ::restart:/sbin/init
# tty2::askfirst:/bin/sh
# tty3::askfirst:/bin/sh
# tty4::askfirst:/bin/sh

So runs /etc/init.d/rcS and sets up 4 consoles/terminal ctrl-alt-F1 .. F2 choices.

kernel .config as attached

I boot initially with vga=ask kernel boot parameter and then select the vesa mode that best fits my laptop display, so a framebuffer rather than pure text/console. Which opens up the potential to add in things like fbvnc (so could vnc into a vnc server box and have a full gui desktop X session) and/or things like fim for displaying images in the 'console' or mplayer/cvlc for videos ..etc.