Read the Basics of Customizing LiveISO
Parted Magic will run scripts placed in the ISO under /pmagic/pmodules/scripts/ and/or if you extract the FileSystem it will run anything placed inside
/tmp/squashfs-root/root/.config/openbox/autostart.d/*
To add an Alias to Root’s Profile:
sudo nano /tmp/squashfs-root/etc/profile
Example:
alias vnc='chmod a+x /root/.xinitrc && vncserver :60'
Enable SSH
sudo sh -c 'echo "PermitRootLogin yes" >> /tmp/squashfs-root/etc/ssh/sshd_config'
AutoStart VNC @ Boot Script:
If you place this script inside the ISO under /scripts/, it requires you to type in the PWD, so you must put the script inside the squashed filesystem under /tmp/squashfs-root/root/.config/openbox/autostart.d/autostartvnc.sh
sudo sh -c 'echo "chmod a+x /root/.xinitrc & vncserver :60" >> /tmp/squashfs-root/root/.config/openbox/autostart.d/autostartvnc.sh' sudo chmod +x /tmp/squashfs-root/root/.config/openbox/autostart.d/autostartvnc.sh
Use SendMail BusyBox to send E-Mail from Command Line in Parted Magic @ boot
Confirmed Working with G-Mail - Comcast - GoDaddy
cat << 'EOL'>/tmp/squashfs-root/root/.config/openbox/autostart.d/sendmail_busybox.sh #!/bin/sh while [ -z "$IP" ];do IP="$(ifconfig | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | grep -v 127.0.0.1 | grep -v 255)" done if [ -n "$IP" ]; then ping -w 30 localhost FROM="username@gmail.com" AUTH="username" PASS="password" FROMNAME="Parted Magic LiveISO" TO="username@gmail.com" SUBJECT="Parted Magic LiveISO Running" BODY="The PartedMagic LiveISO is Running a VNC server on $IP:60 PASS_WD=partedmagic" SENDMAIL=/sbin/sendmail #G-Mail SERVER=smtp.gmail.com #Comcast Business #SERVER=smtp.hmc1.comcast.net #Comcast Residential #smtp.comcast.net PORT=587 echo "Subject: $SUBJECT From: \"$FROMNAME\" <$FROM> Date: $(date -R) $BODY " | "$SENDMAIL" \ -H"exec openssl s_client -quiet -connect $SERVER:$PORT -tls1 -starttls smtp" \ -f"$FROM" -au"$AUTH" -ap"$PASS" $TO fi EOL chmod +x /tmp/squashfs-root/root/.config/openbox/autostart.d/sendmail_busybox.sh
Set Static IP: (Work IN Progress)
I had trouble with this, bit of a hack, creating ifdown/ifup/ifdown/ifup script then edit /etc/network/interfaces as normal. Will update next time I try this. I usually make a PMagic ISO with a static IP for each Network I manage.
ifupdown.sh
sudo sh -c 'echo "ifdown eth0 ; ifup eth0 ; ifdown eth0 ; ifup eth0" >> /tmp/squashfs-root/root/.config/openbox/autostart.d/ifupdown.sh' && chmod 777 /tmp/squashfs-root/root/.config/openbox/autostart.d/ifupdown.sh
sudo rm /tmp/squashfs-root/etc/network/interfaces && sudo nano /tmp/squashfs-root/etc/network/interfaces
#LoopBack auto lo iface lo inet loopback #Eth0 auto eth0 iface eth0 inet static address 192.168.1.### netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 192.168.1.1