I will add some code and make the service turn on and off in samba.sh.
I do not want the service to idle when samba is disabled.
KLA-OT2baseCE-1.1 ( 766 MiB )
Moderator: Forum moderators
- Sofiya
- Posts: 1872
- Joined: Tue Dec 07, 2021 9:49 pm
- Has thanked: 1235 times
- Been thanked: 1126 times
Re: KLA-OT2baseCE-1.1 final ( 766 MiB )
Vanilla Dpup 9.2.X - KLV-Airedale - KLA-OT2
PUPPY LINUX Simple fast free
-
- Posts: 852
- Joined: Wed Aug 19, 2020 5:43 pm
- Location: Edinburgh
- Has thanked: 531 times
- Been thanked: 234 times
- Contact:
Re: KLA-OT2baseCE-1.1 final ( 766 MiB )
Hi, theres a solution to this. You can do almost everything using visual resources, and forget commands.
Go to F96CE-XFCE- FUSILLI and you can do everything you need using software.
PupControl, pupadmin, Fusilli and much more resources prepared to make puppy easier.
You dont need to be a developer to use them, and if u need something special you can always ask.
Give it a try
fredx181 wrote: ↑Wed Mar 15, 2023 11:33 amkeniv wrote:...
I am note trying to criticise developers of these OSs. They are doing something I cannot do myself and I am very grateful for their efforts which is something that I don't think is said enough in this forum but I would also like to say that as a member of this forum with little knowledge of the command line or how these OSs are put together that there must be a place for me and those like me to help. I think we need some honesty as to where in the development this can take place and whether a particular OS would be more suited to more knowledgeable linux users. I can only say that doing what I've done over the last days with no success is just demotivating. I am not trying to be controversial here. I am simply expressing an opinion. I may be the only member of this forum that holds this opinion.
...I agree that essential things like keyboard choice, timezone setup etc... should be easy to do, without terminal commands, so you're not alone.
~
F96CE_XFCE_FUSILLI ====> https://puppyxfcefusilli.wordpress.com/
- rockedge
- Site Admin
- Posts: 5847
- Joined: Mon Dec 02, 2019 1:38 am
- Location: Connecticut,U.S.A.
- Has thanked: 2096 times
- Been thanked: 2188 times
- Contact:
Re: KLA-OT2baseCE-1.1 final ( 766 MiB )
@Sofiya here is what I have in /usr/local/bin/samba.sh
->
Code: Select all
#!/bin/sh
#simple samba settings
#01micko 111122, 120215
#gpl3
#check for 1 running instance
RUNNING=`ps |grep SMBGUI|grep -v grep`
[ "$RUNNING" != "" ] && exit 0
# sort out the message app
type gxmessage 2>&1 >/dev/null && MSGAPP=gxmessage border='-borderless' || MSGAPP=xmessage border=
export MSGAPP border
#just in case
#chmod 755 /etc/init.d/rc.samba
#is this config generated by this script?
head -n2 /etc/samba/smb.conf|grep -q rcrsn51
if [ $? -ne 0 ];then
Xdialog --title "Samba Simple Setup" --ok-label "Continue?" --cancel-label "Quit?" --yesno "It is recommended you \
quit this setup \n as you have a custom smb.conf.\
\nIf you continue a backup will be made of your config." 0 0
[ $? -ne 0 ]&& exit
cp -af /etc/samba/smb.conf /etc/samba/smb.conf.old
fi
##check for custom smb.conf hmmmm multiple shares would conflict with this... would be better to work with ANY samba config..ie use sed or take the wbar approach. Rejects if longer than 3 entries.
#CUSTOM=`grep '^\[' /etc/samba/smb.conf|wc -l`
#if [ "$CUSTOM" -gt "3" ];then
# Xdialog --title "Simple Samba Management" --ok-label="Continue" --cancel-label="Quit" --yesno "You have a custom Samba #configuration. \nThis tool will overwrite your /etc/samba/smb.conf \nhowever a backup will be made automatically. \nIt is #recommended you quit and \nconfigure Samba manually" 0 0 0
# [ $? -ne 0 ]&& exit
# cp -af /etc/samba/smb.conf /etc/samba/smb.conf.old
#fi
#detect if samba is running
_status(){
SAMBARUNNING=`pidof smbd|head -c1`
if [ "$SAMBARUNNING" != "" ];then
ln -sf /usr/share/pixmaps/samba/on.png /tmp/samba.png
else
ln -sf /usr/share/pixmaps/samba/off.png /tmp/samba.png
fi
}
#switch samba daemon on/off
togglesamba(){
SAMBARUNNING=`pidof smbd|head -c1`
if [ "$SAMBARUNNING" != "" ];then
systemctl stop smb
systemctl stop nmb
else
systemctl start smb
systemctl start nmb
fi
sleep 1
_status
}
#generate smb.conf
swapvalues(){
NETBIOSNAME="netbios name = $SERVERNAME"
if [ "$SERVERNAME" = "" ];then
# SERVERNAME=""
NETBIOSNAME=""
fi
echo "#this is a very simple smb.conf to get you started
#coutesy rcrsn51 and gcmartin
[global]
workgroup = $WGROUP
$NETBIOSNAME
server string = KLA-OT2
security = user
map to guest = Bad Password
printing = cups
printcap name = cups
load printers = yes
[$SHARENAME]
path = $MYPATH
writable = yes
" > /tmp/smb.conf
[ $MYPATH2 ]&& echo "
[$SHARENAME2]
path = $MYPATH2
writable = yes
" >> /tmp/smb.conf
[ $MYPATH3 ]&& echo "
[$SHARENAME3]
path = $MYPATH3
writable = yes
" >> /tmp/smb.conf
echo "
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = yes
writable = no
printable = yes
" >> /tmp/smb.conf
# [ "`grep BLANK /tmp/smb.conf`" != "" ]&& sed -i 's%BLANK%%' /tmp/smb.conf
}
#config test
testconfig(){
# testparm -s /tmp/smb.conf >/tmp/testparm.log 2>&1
testparm >/tmp/testparm.log 2>&1
[ $? -ne 0 ]&& "$MSGAPP" -center -bg "#e77" -timeout 5 "ERROR: your smb.conf is not correct, try again" && return
echo "" >> /tmp/testparm.log
SVPATH=`grep "path" /tmp/smb.conf|awk '{print $3}'|head -n1`
[ ! $SVPATH ] && echo "ERROR: SHARED PATH IS MISSING" >> /tmp/testparm.log || echo "Ok" >> /tmp/testparm.log
WORKGROUPSET=`grep "workgroup" /tmp/smb.conf|awk '{print $3}'`
[ ! $WORKGROUPSET ] && echo "ERROR: WORKGROUP IS MISSING" >> /tmp/testparm.log || echo "Ok" >> /tmp/testparm.log
"$MSGAPP" -file /tmp/testparm.log
}
#apply new settings if passes similar test to above... gui may have been altered after test to fresh config created anyway.
_apply(){
[ ! $MYPATH ] && "$MSGAPP" -center -bg "#e77" -timeout 5 $border -buttons "" "ERROR: Aborting, you must enter a share path" && return
[ ! $WGROUP ] && "$MSGAPP" -center -bg "#e77" -timeout 5 $border -buttons "" "ERROR: Aborting, you must enter a workgroup" && return
testparm -s /tmp/smb.conf >/tmp/testparm.log 2>&1
[ $? -ne 0 ]&& "$MSGAPP" -center -bg "#e77" -timeout 20 "ERROR: Aborting, Something went wrong with the Samba configuration.
Check the log at /tmp/testparm.log.
Please try again or consult the documentation in /usr/share/help
Your SAMBA config has NOT been changed" && return
cp -af /tmp/smb.conf /etc/samba/ #instate new smb.conf IF passes test
/etc/init.d/rc.samba restart &
"$MSGAPP" -center -bg "#4c4" -timeout 6 $border -buttons "" "Samba is starting/restarting.
You can check the log at /tmp/testparm.log"
}
export -f swapvalues
export -f testconfig
export -f _status
export -f togglesamba
export -f _apply
#just in case..I suspect not needed as would write a fresh one...should clean up at the end really
[ -f /tmp/smb.conf ] && rm -f /tmp/smb.conf
#initialise status button
_status
#extract parameters or use fallbacks
MYPATH=`grep -iE 'path' /etc/samba/smb.conf|grep -v 'var'|grep -v 'tmp'|awk 'NR==1{print $3}'`
[ ! $MYPATH ]&& MYPATH=/root
SHARENAME=`grep -iE '^\[' /etc/samba/smb.conf|grep -v 'global'|grep -v 'printers'|sed -e 's%\[%%' -e 's%\]%%'| awk 'NR==1'`
[ ! $SHARENAME ]&& SHARENAME="puppyshare"
MYPATH2=`grep -iE 'path' /etc/samba/smb.conf|grep -v 'var'|grep -v 'tmp'|awk 'NR==2{print $3}'`
SHARENAME2=`grep -iE '^\[' /etc/samba/smb.conf|grep -v 'global'|grep -v 'printers'|sed -e 's%\[%%' -e 's%\]%%'| awk 'NR==2'`
[ $MYPATH2 ]&& PATH2="<default>$MYPATH2</default>" && SHARE2="<default>$SHARENAME2</default>"
MYPATH3=`grep -iE 'path' /etc/samba/smb.conf|grep -v 'var'|grep -v 'tmp'|awk 'NR==3{print $3}'`
SHARENAME3=`grep -iE '^\[' /etc/samba/smb.conf|grep -v 'global'|grep -v 'printers'|sed -e 's%\[%%' -e 's%\]%%' | awk 'NR==3'`
[ $MYPATH3 ]&& PATH3="<default>$MYPATH3</default>" && SHARE3="<default>$SHARENAME3</default>"
CURSERVER=`grep "netbios" /etc/samba/smb.conf|awk '{print $4}'`
[ ! $CURSERVER ] && CURSERVER="$(hostname)"
WGROUP=`grep "workgroup" /etc/samba/smb.conf|awk '{print $3}'`
#GUI
export SMBGUI="<window title=\"Samba Simple Management\" icon-name=\"gtk-network\" resizable=\"false\">
<vbox>
<hbox homogeneous=\"true\">
<text use-markup=\"true\"><label>\"<b>You can personalise some Samba settings here</b>\"</label></text>
</hbox>
<hbox homogeneous=\"true\">
<text use-markup=\"true\"><label>\"The default <b>user</b> is: <b>root</b>\"</label></text>
</hbox>
<hbox homogeneous=\"true\">
<text use-markup=\"true\"><label>\"The default <b>password</b> is: <b>root</b>\"</label></text>
</hbox>
<hbox homogeneous=\"true\">
<text use-markup=\"true\"><label>\"You can change this and add users later\"</label></text>
</hbox>
<hseparator></hseparator>
<hbox>
<pixmap>
<height>40</height>
<input file>/usr/share/pixmaps/samba/samba.png</input>
</pixmap>
<text><label>Switch Samba Daemon on or off.</label></text>
<button tooltip-text=\"hitting this button when Green will turn off Samba, when Red will turn on Samba\">
<variable>ARTWORK</variable>
<input file>/tmp/samba.png</input>
<action>togglesamba</action>
<action type=\"refresh\">ARTWORK</action>
</button>
</hbox>
<hseparator></hseparator>
<hbox homogeneous=\"true\">
<text use-markup=\"true\"><label>\"You can change the default server <b>netbios</b> name if you wish.\"</label></text>
</hbox>
<hbox homogeneous=\"true\">
<text use-markup=\"true\"><label>\"The default is <b>$(hostname)</b>\"</label></text>
<entry tooltip-text=\"If $(hostname) is in this entry or it is left blank then your netbios name will be $(hostname) which is your computer's hostname. You can change it to anything you like as long as there are no spaces and chars are alpha/numeric. Dots, dashes and underscores are allowed\">
<default>$CURSERVER</default>
<variable>SERVERNAME</variable>
</entry>
</hbox>
<hseparator></hseparator>
<hbox homogeneous=\"true\">
<text use-markup=\"true\"><label>\"The current Sharename is <b>$SHARENAME</b> and the default share path is <b>/root</b>, change either or both if you wish. You can have up to three shares.\"</label></text>
</hbox>
<hbox>
<entry tooltip-text=\"$SHARENAME is the default mount point of your server. You can change it to anything you like as long as there are no spaces and chars are alpha/numeric. Dots, dashes and underscores are allowed\">
<variable>SHARENAME</variable>
<default>$SHARENAME</default>
</entry>
<entry fs-action=\"folder\">
<variable>MYPATH</variable>
<default>$MYPATH</default>
</entry>
<button tooltip-text=\"Browse for suitable share path\">
<input file stock=\"gtk-open\"></input>
<action>fileselect:MYPATH</action>
</button>
</hbox>
<hbox>
<entry tooltip-text=\"Add a second share here\">
<variable>SHARENAME2</variable>
$SHARE2
</entry>
<entry fs-action=\"folder\">
<variable>MYPATH2</variable>
$PATH2
</entry>
<button tooltip-text=\"Browse for suitable share path\">
<input file stock=\"gtk-open\"></input>
<action>fileselect:MYPATH2</action>
</button>
</hbox>
<hbox>
<entry tooltip-text=\"Add a third share here\">
<variable>SHARENAME3</variable>
$SHARE3
</entry>
<entry fs-action=\"folder\">
<variable>MYPATH3</variable>
$PATH3
</entry>
<button tooltip-text=\"Browse for suitable share path\">
<input file stock=\"gtk-open\"></input>
<action>fileselect:MYPATH3</action>
</button>
</hbox>
<hseparator></hseparator>
<hbox>
<text use-markup=\"true\"><label>\"Change the default <b>workgroup</b> name\"</label></text>
<entry tooltip-text=\"If you have Microsoft Windows machines on your network you should set the Workgroup to the same name as the Windows Workgroup\">
<default>$WGROUP</default>
<variable>WGROUP</variable>
</entry>
</hbox>
<hseparator></hseparator>
<hbox homogeneous=\"true\" space-expand=\"false\" space-fill=\"true\">
<button image-position=\"1\" use-stock=\"true\" label=\"gtk-apply\" tooltip-text=\"Perform a sanity check before applying your settings and restarting Samba.\">
<action>swapvalues</action>
<action>_apply</action>
<action>_status</action>
<action type=\"refresh\">ARTWORK</action>
</button>
<button tooltip-text=\"Click to check your new settings without applying.\">
<label>Test</label>
<input file stock=\"gtk-index\"></input>
<action>swapvalues</action>
<action>testconfig</action>
</button>
<button image-position=\"1\" use-stock=\"true\" label=\"gtk-quit\" tooltip-text= \"Exit leaving your current settings and status alone\">
<action>exit:quit</action>
</button>
</hbox>
</vbox>
</window>"
gtk2dialog -c --program=SMBGUI
This version has been modified for KLA-OT2 and uses systemd service start/stop commands like systemctl stop smb
- Sofiya
- Posts: 1872
- Joined: Tue Dec 07, 2021 9:49 pm
- Has thanked: 1235 times
- Been thanked: 1126 times
Re: KLA-OT2baseCE-1.1 final ( 766 MiB )
I have almost the same thing, just added more code
Vanilla Dpup 9.2.X - KLV-Airedale - KLA-OT2
PUPPY LINUX Simple fast free
- Sofiya
- Posts: 1872
- Joined: Tue Dec 07, 2021 9:49 pm
- Has thanked: 1235 times
- Been thanked: 1126 times
Re: KLA-OT2baseCE-1.1 final ( 766 MiB )
KLA-OT2baseCE-1.3 final
viewtopic.php?t=8378
Vanilla Dpup 9.2.X - KLV-Airedale - KLA-OT2
PUPPY LINUX Simple fast free