Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FUSS
fuss-fucc
Commits
bb456d9f
Unverified
Commit
bb456d9f
authored
Aug 28, 2019
by
Marco Marinello
Browse files
Save sftp dir
Signed-off-by:
Marco Marinello
<
mmarinello@sezf.it
>
parent
9549994e
Changes
3
Hide whitespace changes
Inline
Side-by-side
debian/postinst
View file @
bb456d9f
...
...
@@ -55,3 +55,6 @@ chown -R clonezilla. ${SFTPDIR}/clientScripts
chmod
-R
770
${
SFTPDIR
}
/clientScripts
chown
clonezilla.
${
SFTPDIR
}
/computerList.txt
mkdir
-p
/etc/fuss-fucc
echo
$SFTPDIR
>
/etc/fuss-fucc/sftpdir
debian/prerm
View file @
bb456d9f
...
...
@@ -11,6 +11,7 @@ SFTPDIR="$RET"
# Remove installed files
rm
-rf
${
SFTPDIR
}
/clientScripts
# Do not delete computerList.txt as far as it may still be useful
rm
-rf
/etc/fuss-fucc
# Prune the debconf database
db_purge
fuss-fucc
0 → 100755
View file @
bb456d9f
#!/bin/bash
# Copyright (c) 2019 Marco Marinello <mmarinello@fuss.bz.it>
case
$1
in
rootpw
)
read
-s
-p
"Clients password: "
pw1
echo
read
-s
-p
"Confirm clients password: "
pw2
echo
if
!
[
"
$pw1
"
=
"
$pw2
"
]
;
then
echo
"Password mismatch! Please retry"
else
perl
-e
"print crypt(
\"
$pw1
\"
,
\"
salt
\"
)"
>
$(
cat
/etc/fuss-fucc/sftpdir
)
/clientScripts/new_root_pw
fi
unset
pw1
unset
pw2
;;
octolist
)
IMAGE
=
"
$2
"
JOIN
=
"join"
DB
=
"/var/lib/octofuss/octofuss.db"
OUTFILE
=
"
$(
cat
/etc/fuss-fucc/sftpdir
)
/computerList.txt.octo-new"
rm
-f
${
OUTFILE
}
touch
${
OUTFILE
}
PCS
=
$(
sqlite3
$DB
<<
EOF
select distinct hostname from client_component;
.quit
EOF
)
for
fqdn
in
$PCS
;
do
client
=
$(
echo
$fqdn
|
cut
-d
'.'
-f
1
)
# Check if the host has already been mapped
if
!
grep
$client
list.txt 2>&1
>
/dev/null
;
then
# Find that MAC
MAC
=
$(
sqlite3
$DB
<<
EOF
select value from client_component where hostname = "
$fqdn
" and component like "mac%";
.quit
EOF
)
MAC
=
$(
echo
$MAC
|cut
-d
' '
-f
1
)
if
[
-z
"
$MAC
"
]
;
then
echo
"No mac for
${
fqdn
}
"
else
if
!
grep
$MAC
${
OUTFILE
}
2>&1
>
/dev/null
;
then
THIS
=
"
$IMAGE
"
echo
$client
$MAC
$THIS
$JOIN
$(
grep
$client
/etc/clusters |
head
-1
|
cut
-d
' '
-f
1
)
>>
${
OUTFILE
}
else
echo
"
$MAC
has more than one fqdn (
${
fqdn
}
)"
fi
fi
fi
done
;;
*
)
echo
"Usage:
$0
[SUBCOMMAND]"
echo
echo
-e
"
\t
rootpw
\t\t
Generate and save the root
\n\t\t\t
password for the installed clients"
echo
-e
"
\t
octolist [image]
\t
Generate the computerList.txt from
\n\t\t\t
the OctoFuss database"
;;
esac
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment