Remove extra scripts
This commit is contained in:
@@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
if (( $EUID != 0 )); then
|
|
||||||
echo "Please run as root (sudo)"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $SUDO_USER ]; then user=$SUDO_USER; fi
|
|
||||||
echo 'Do not remove the generic instance!'
|
|
||||||
PS3='Select instance to remove: '
|
|
||||||
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p')
|
|
||||||
select opt in "${options[@]}"
|
|
||||||
do
|
|
||||||
echo "Selected instance: $opt"
|
|
||||||
break
|
|
||||||
done
|
|
||||||
|
|
||||||
read -p "Do you want to remove everything associated with this instance?" -n 1 -r
|
|
||||||
echo #new line
|
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
#disable and remove service file
|
|
||||||
if [ -f /etc/systemd/system/$opt.service ]; then
|
|
||||||
systemctl stop $opt.service
|
|
||||||
systemctl disable $opt.service
|
|
||||||
rm /etc/systemd/system/$opt.service
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /etc/systemd/system/cam_$opt.service ]; then
|
|
||||||
systemctl stop cam_$opt.service
|
|
||||||
systemctl disable cam_$opt.service
|
|
||||||
rm /etc/systemd/system/cam_$opt.service
|
|
||||||
sed -i "/cam_$opt/d" /etc/udev/rules.d/99-octoprint.rules
|
|
||||||
fi
|
|
||||||
#remove udev entry
|
|
||||||
sed -i "/$opt/d" /etc/udev/rules.d/99-octoprint.rules
|
|
||||||
#remove files
|
|
||||||
rm -rf /home/$user/.$opt
|
|
||||||
#remove from octoprint_instances
|
|
||||||
sed -i "/$opt/d" /etc/octoprint_instances
|
|
||||||
fi
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
journalctl --rotate > /dev/null 2>&1
|
|
||||||
journalctl --vacuum-time=1seconds > /dev/null 2>&1
|
|
||||||
echo "Plug your printer in via USB now (detection time-out in 1 min)"
|
|
||||||
counter=0
|
|
||||||
while [[ -z "$UDEV" ]] && [[ $counter -lt 30 ]]; do
|
|
||||||
UDEV=$(timeout 1s journalctl -kf | sed -n -e 's/^.*SerialNumber: //p')
|
|
||||||
TEMPUSB=$(timeout 1s journalctl -kf | sed -n -e 's/^.*\(cdc_acm\|ftdi_sio\|ch341\) \([0-9].*[0-9]\): \(tty.*\|FTD.*\|ch341-uart.*\).*/\2/p')
|
|
||||||
counter=$(( $counter + 1 ))
|
|
||||||
if [ -n "$TEMPUSB" ]; then
|
|
||||||
echo $TEMPUSB
|
|
||||||
fi
|
|
||||||
if [ -n "$UDEV" ]; then
|
|
||||||
echo "Serial Number detected: $UDEV"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user